#!/usr/bin/bash

#	Copyright 2014-2021 George Savvidis

#	This program is free software: you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation, either version 2 of the License, or
#	(at your option) any later version.

#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.

#	You should have received a copy of the GNU General Public License
#	along with this program.  If not, see <http://www.gnu.org/licenses/>.

Version=3.4.2

# Defining colors and bold letters
lightgreen='\e[1;32m'
lightred='\e[1;31m'
red='\e[0;31m'
lightblue='\e[1;34m'
NC='\e[0m'
bold=`tput bold`
normal=`tput sgr0`

# Options, help, database update and error messages
for i in "$@"; do
	if [[ "$i" =~ ^-([huqQswpPv]*)h([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--help$ ]]; then
		help=set
	fi
	if [[ "$i" =~ ^-([huqQswpPv]*)u([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--update$ ]]; then
		update=set
	fi
	if [[ "$i" =~ ^-([huqQswpPv]*)q([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--quiet$ ]]; then
		quiet=set
	fi
	if [[ "$i" =~ ^-([huqQswpPv]*)Q([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--Quiet$ ]]; then
		Quiet=set
	fi
	if [[ "$i" =~ ^-([huqQswpPv]*)s([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--pseudo$ ]]; then
		pseudo=set
	fi
	if [[ "$i" =~ ^-([huqQswpPv]*)w([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--wipeout$ ]]; then
		wipeout=set
	fi
	if [[ "$i" =~ ^-([huqQswpPv]*)p([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--pkgbuild$ ]]; then
		pkgbuild=set
	fi
	if [[ "$i" =~ ^-([huqQswpPv]*)P([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--Pkgbuild$ ]]; then
		Pkgbuild=set
	fi
 	if [[ "$i" =~ ^-([huqQswpPv]*)v([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--version$ ]]; then
		version=set
	fi
done
if [[ $pseudo == set ]] && [[ ! -e /var/lib/pacman/sync/multilib.db ]] && [[ ! -e /var/lib/pacman/sync/multilib-testing.db ]]; then
	echo -e "${red}Error: You are either running non-x86_64 Arch Linux, or you haven't enabled multilib repository. If you are running x86_64 Arch Linux, you must enable a multilib repository and then synchronize pacman database${NC}"; exit 1
fi
if [[ $help == set ]]; then
	echo -e "Syntax: debtap [options] package_filename\n\nOptions:\n\n    -h  --help        Print this help message\n    -u  --update      Update debtap database\n    -q  --quiet       Bypass all questions, except for editing metadata file(s)\n    -Q  --Quiet       Bypass all questions (not recommended)\n    -s  --pseudo      Create a pseudo-64-bit package from a 32-bit .deb package\n    -w  --wipeout     Wipeout versions from all dependencies, conflicts etc.\n    -p  --pkgbuild    Additionally generate a PKGBUILD file\n    -P  --Pkgbuild    Generate a PKGBUILD file only\n    -v  --version     Print version"; exit 0
elif [[ $version == set ]]; then
	echo -e "$Version"; exit 0
elif [[ $update == set ]]; then
    if [[ $EUID != 0 ]]; then
        echo -e "${red}Error: You must run this command with root privileges${NC}"; exit 1
    else
        mkdir -p /var/cache/debtap 2> /dev/null
        chmod 755 /var/cache/debtap
        echo -e "${lightgreen}==>${NC} ${bold}Synchronizing pkgfile database...${normal}"
        pkgfile -u
        if [[ $(echo $?) != 0 ]]; then
            echo -e "${red}Synchronization failed. Exiting...${NC}"; exit 1
        else
            echo -e "${lightgreen}==>${NC} ${bold}Synchronizing debtap database...${normal}"
            if [[ "$(uname -m)" == "i686" ]] || [[ "$(uname -m)" == "x86_64" ]]; then
                _arch=amd64
            elif [[ "$(uname -m)" == "armv7l" ]] || [[ "$(uname -m)" == "armv7h" ]]; then
                _arch=armhf
            elif [[ "$(uname -m)" == "aarch64" ]]; then
                _arch=arm64
            fi
            ubuntu_latest_stable_version=`curl -s https://packages.ubuntu.com | grep option | gawk -F '=' '{print $2}' | gawk '{print $1}' | grep -v option | tac | sed -n 3'{p;q;}' | sed s'/\("\|-updated\|-backports\)//g'`
            curl -C - -f http://ftp.debian.org/debian/dists/sid/main/Contents-$_arch.gz > /var/cache/debtap/debian-main-packages-files.gz
            gzip -df /var/cache/debtap/debian-main-packages-files.gz
            curl -C - -f http://ftp.debian.org/debian/dists/sid/non-free/Contents-$_arch.gz > /var/cache/debtap/debian-non-free-packages-files.gz
            gzip -df /var/cache/debtap/debian-non-free-packages-files.gz
            curl -C - -f http://ftp.debian.org/debian/dists/sid/contrib/Contents-$_arch.gz > /var/cache/debtap/debian-contrib-packages-files.gz
            gzip -df /var/cache/debtap/debian-contrib-packages-files.gz
            if [[ $_arch == amd64 ]]; then
                curl -C - -f http://archive.ubuntu.com/ubuntu/dists/$ubuntu_latest_stable_version/Contents-$_arch.gz > /var/cache/debtap/ubuntu-packages-files.gz
            else
                curl -C - -f http://ports.ubuntu.com/ubuntu-ports/dists/$ubuntu_latest_stable_version/Contents-$_arch.gz > /var/cache/debtap/ubuntu-packages-files.gz
            fi
            gzip -df /var/cache/debtap/ubuntu-packages-files.gz
            if [[ $(echo $?) != 0 ]]; then
                echo -e "${red}Synchronization failed. Exiting...${NC}"; exit 1
            else
                echo -e "${lightgreen}==>${NC} ${bold}Downloading latest virtual packages list...${normal}"
                curl -L https://github.com/helixarch/virtual-packages-list-generator/archive/master.tar.gz > /var/cache/debtap/master.tar.gz
                tar xfz /var/cache/debtap/master.tar.gz -C /var/cache/debtap
                mv /var/cache/debtap/virtual-packages-list-generator-master/virtual-packages /var/cache/debtap
                rm -rf /var/cache/debtap/master.tar.gz /var/cache/debtap/virtual-packages-list-generator-master
                if [[ $(echo $?) != 0 ]]; then
                    echo -e "${red}Downloading failed. Exiting...${NC}"; exit 1
                else
                    echo -e "${lightgreen}==>${NC} ${bold}Downloading latest AUR packages list...${normal}"
                    curl -C - -f https://aur.archlinux.org/packages.gz > /var/cache/debtap/aur-packages.gz
                    gzip -df /var/cache/debtap/aur-packages.gz
                    if [[ $(echo $?) != 0 ]]; then
                        echo -e "${red}Downloading failed. Exiting...${NC}"; exit 1
                    else    
                        echo -e "${lightgreen}==>${NC} ${bold}Generating base group packages list...${normal}"
                        rm -rf /var/cache/debtap/base-packages
                        for i in $(pacman -Qi base 2> /dev/null | grep ^Depends | cut -d: -f2); do echo "$i" >> /var/cache/debtap/base-packages; done; echo >> /var/cache/debtap/base-packages
                        chmod 644 /var/cache/debtap/*
                        echo -e "${lightgreen}==>${NC} ${bold}All steps successfully completed!${normal}"; exit 0
                    fi
                fi
            fi
        fi
    fi
elif [[ "${@: -1}" == "debtap" ]] || [[ "${@: -1}" =~ /debtap$ ]] || [[ "${@: -1}" =~ ^-([qQswpP]+)$ ]] || [[ "${@: -1}" =~ ^--([quiet|Quiet|pseudo|wipeout|pkgbuild|Pkgbuild]){1,}$ ]]; then
	echo -e "${red}Error: You haven't specified a deb package${NC}\nSyntax: debtap [options] package_filename\n\nOptions:\n\n    -h  --help        Print this help message\n    -u  --update      Update debtap database\n    -q  --quiet       Bypass all questions, except for editing metadata file(s)\n    -Q  --Quiet       Bypass all questions (not recommended)\n    -s  --pseudo      Create a pseudo-64-bit package from a 32-bit .deb package\n    -w  --wipeout     Wipeout versions from all dependencies, conflicts etc.\n    -p  --pkgbuild    Additionally generate a PKGBUILD file\n    -P  --Pkgbuild    Generate a PKGBUILD file only\n    -v  --version     Print version"; exit 1
elif [[ "${@: -1}" =~ ^(-)+(.)*$ ]] || [[ $(ls "${@: -1}" &> /dev/null; echo $?) != 0 ]]; then
	echo -e "${red}Error: No such file or directory or invalid option${NC}"; exit 1
elif [[ $(file -S -b "${@: -1}" | grep -q "Debian binary package"; echo $?) != 0 ]]; then
	echo -e "${red}Error: You haven't specified a valid deb package${NC}"; exit 1
fi

if [[ ! $(ls /var/cache/pkgfile/*.files 2> /dev/null) ]] || [[ ! $(ls /var/cache/debtap/*-packages-files 2> /dev/null) ]] || [[ ! -e /var/cache/debtap/base-packages ]] || [[ ! -e /var/cache/debtap/aur-packages ]] || [[ ! -e /var/cache/debtap/virtual-packages ]]; then
	if [[ $pseudo != set ]]; then
		echo -e "${red}Error: You must run at least once \"debtap -u\" with root privileges (preferably recently), before running this script${NC}"; exit 1
	else
		echo -e "${red}Error: You must enable a multilib repository, synchronize pacman database and then run at least once \"debtap -u\" with root privileges (preferably recently), before running this script${NC}"; exit 1
	fi
fi

# Defining package with full path & defining and creating working directory
package_with_full_path="`readlink -f "${@: -1}"`"
working_directory="`basename "${@: -1}" | tr '[:upper:]' '[:lower:]' | sed s'/\.deb$//'`-working-directory"
rm -rf "$working_directory" 2> /dev/null
mkdir "$working_directory" 2> /dev/null
if [[ $(echo $?) != 0 ]]; then
	echo -e "${red}Error: Cannot create working directory, permission denied. Exiting...${NC}"
	exit 1
fi
cd "$working_directory"

# Extracting package data and metadata in working directory (also checking package architecture, if you are running the pseudo option)
echo -e "${lightgreen}==>${NC} ${bold}Extracting package data...${normal}"
control_tar_check=`ar t "$package_with_full_path" | grep control`
if [[ $control_tar_check == control.tar.gz ]]; then
    ar p "$package_with_full_path" control.tar.gz | tar xz
elif [[ $control_tar_check == control.tar.xz ]]; then
    ar p "$package_with_full_path" control.tar.xz | tar xJ
fi
if [[ $pseudo == set ]] && [[ $(grep ^Architecture: control | grep -q i386; echo $?) != 0 ]]; then
    echo -e "${red}Error: Invalid package architecture. Removing extracted package data and exiting...${NC}"
    cd ..
    rm -rf "$working_directory"
    exit 1
fi
rm -rf $(ls * | grep -v 'control\|preinst\|postinst\|prerm\|postrm\|conffiles')
data_tar_check=`ar t "$package_with_full_path" | grep data`
if [[ $data_tar_check == data.tar.gz ]]; then
    ar p "$package_with_full_path" data.tar.gz | tar xz
elif [[ $data_tar_check == data.tar.xz ]]; then
    ar p "$package_with_full_path" data.tar.xz | tar xJ
elif [[ $data_tar_check == data.tar.bz2 ]]; then
    ar p "$package_with_full_path" data.tar.bz2 | tar xj
elif [[ $data_tar_check == data.tar.lzma ]]; then
    ar p "$package_with_full_path" data.tar.lzma | tar xJ
elif [[ $data_tar_check == data.tar ]]; then
    ar p "$package_with_full_path" data.tar | tar x
fi

# Fixing possible differences in filesystem hierarchy of the extracted package data, so that it matches Arch Linux filesystem hierarchy
echo -e "${lightgreen}==>${NC} ${bold}Fixing possible directories structure differencies...${normal}"
if [[ $pkgbuild == set ]] || [[ $Pkgbuild == set ]]; then
	if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]]; then
		echo "install -D -m644 \"$(find ./ -iname '*license*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
	fi
	if [[ $(find ./ -iname '*copyright*' | wc -l) != 0 ]]; then
		if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]]; then
			echo "install -D -m644 \"$(find ./ -iname '*copyright*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/COPYRIGHT\"" >> pkgbuildinstallations1
		else
			echo "install -D -m644 \"$(find ./ -iname '*copyright*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
		fi
	fi
	if [[ $(find ./ -iname '*eula*' | wc -l) != 0 ]]; then
		if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]] || [[ $(find ./ -iname '*copyright*' | wc -l) != 0 ]]; then
			echo "install -D -m644 \"$(find ./ -iname '*eula*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/EULA\"" >> pkgbuildinstallations1
		else
			echo "install -D -m644 \"$(find ./ -iname '*eula*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
		fi
	fi
	if [[ -e usr/games ]]; then
		echo 'mkdir usr/bin 2> /dev/null; mv usr/games/* usr/bin; rm -rf usr/games' >> pkgbuildinstallations1
		if [[ -e usr/share/applications ]]; then
			echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/games\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
		fi
	fi
	if [[ -e bin ]]; then
		echo 'mkdir -p usr/bin 2> /dev/null; mv bin/* usr/bin; rm -rf bin' >> pkgbuildinstallations1
		if [[ -e usr/share/applications ]]; then
			echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/bin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
		fi
	fi
	if [[ -e sbin ]]; then
		echo 'mkdir -p usr/bin 2> /dev/null; mv sbin/* usr/bin; rm -rf sbin' >> pkgbuildinstallations1
		if [[ -e usr/share/applications ]]; then
			echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/sbin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
		fi
	fi
	if [[ -e usr/sbin ]]; then
		echo 'mkdir usr/bin 2> /dev/null; mv usr/sbin/* usr/bin; rm -rf usr/sbin' >> pkgbuildinstallations1
		if [[ -e usr/share/applications ]]; then
			echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/sbin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
		fi
	fi
	if [[ -e usr/local/games ]]; then
		echo 'mkdir usr/bin 2> /dev/null; mv usr/local/games/* usr/bin; rm -rf usr/local/games' >> pkgbuildinstallations1
		if [[ -e usr/share/applications ]]; then
			echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/local\\/games\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
		fi
	fi
	if [[ -e usr/local/bin ]]; then
		echo 'mkdir usr/bin 2> /dev/null; mv usr/local/bin/* usr/bin; rm -rf usr/local/bin' >> pkgbuildinstallations1
		if [[ -e usr/share/applications ]]; then
			echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/local\\/bin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
		fi
	fi
	if [[ -e usr/local/sbin ]]; then
		echo 'mkdir usr/bin 2> /dev/null; mv usr/local/sbin/* usr/bin; rm -rf usr/local/sbin' >> pkgbuildinstallations1
		if [[ -e usr/share/applications ]]; then
			echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/local\\/sbin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
		fi
	fi
	if [[ $pseudo != set ]]; then
		if [[ -e lib ]]; then
			echo 'mkdir -p usr/lib 2> /dev/null; mv lib/* usr/lib; rm -rf lib' >> pkgbuildinstallations1
		fi
		if [[ -e lib32 ]]; then
			if [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
				echo 'mkdir -p usr/lib 2> /dev/null; mv lib32/* usr/lib; rm -rf lib32' >> pkgbuildinstallations32
			else
				echo 'mkdir -p usr/lib32 2> /dev/null; mv lib32/* usr/lib32; rm -rf lib32' >> pkgbuildinstallations64
			fi
		fi
		if [[ -e lib64 ]]; then
			echo 'mkdir -p usr/lib 2> /dev/null; mv lib64/* usr/lib; rm -rf lib64' >> pkgbuildinstallations64
		fi
		if [[ -e usr/lib32 ]] && [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
			echo 'mkdir usr/lib 2> /dev/null; mv usr/lib32/* usr/lib; rm -rf usr/lib32' >> pkgbuildinstallations32
		fi
		if [[ -e usr/lib64 ]]; then
			echo 'mkdir usr/lib 2> /dev/null; mv usr/lib64/* usr/lib; rm -rf usr/lib64' >> pkgbuildinstallations64
		fi
		if [[ -e usr/local/lib32 ]] && [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
			echo 'mkdir usr/local/lib 2> /dev/null; mv usr/local/lib32/* usr/local/lib; rm -rf usr/local/lib32' >> pkgbuildinstallations32
		fi
		if [[ -e usr/local/lib64 ]]; then
			echo 'mkdir usr/local/lib 2> /dev/null; mv usr/local/lib64/* usr/local/lib; rm -rf usr/local/lib64' >> pkgbuildinstallations64
		fi
	else
		if [[ -e lib ]]; then
			tac pkgbuildinstallations32 2> /dev/null >> pkgbuildinstallations32-1; echo 'mkdir -p usr/lib 2> /dev/null; mv lib/* usr/lib; rm -rf lib' >> pkgbuildinstallations32-1; tac pkgbuildinstallations32-1 > pkgbuildinstallations32; rm -rf pkgbuildinstallations32-1
			echo 'mkdir -p usr/lib32 2> /dev/null; mv lib/* usr/lib32; rm -rf lib' >> pkgbuildinstallations64
		fi
		if [[ -e lib32 ]]; then
			echo 'mkdir -p usr/lib32 2> /dev/null; mv lib32/* usr/lib32; rm -rf lib32' >> pkgbuildinstallations64
		fi
		if [[ -e usr/lib ]]; then
			echo 'mkdir usr/lib32 2> /dev/null; mv usr/lib/* usr/lib32; rm -rf usr/lib' >> pkgbuildinstallations64
		fi
		if [[ -e usr/local/lib ]]; then
			echo 'mkdir usr/local/lib32 2> /dev/null; mv usr/local/lib/* usr/local/lib32; rm -rf usr/local/lib' >> pkgbuildinstallations64
		fi
	fi
fi

if [[ -e usr/games ]]; then
	mkdir usr/bin 2> /dev/null; mv usr/games/* usr/bin; rm -rf usr/games
fi
if [[ -e bin ]]; then
	mkdir -p usr/bin 2> /dev/null; mv bin/* usr/bin; rm -rf bin
fi
if [[ -e sbin ]]; then
	mkdir -p usr/bin 2> /dev/null; mv sbin/* usr/bin; rm -rf sbin
fi
if [[ -e usr/sbin ]]; then
	mkdir usr/bin 2> /dev/null; mv usr/sbin/* usr/bin; rm -rf usr/sbin
fi
if [[ -e usr/local/games ]]; then
	mkdir usr/bin 2> /dev/null; mv usr/local/games/* usr/bin; rm -rf usr/local/games
fi
if [[ -e usr/local/bin ]]; then
	mkdir usr/bin 2> /dev/null; mv usr/local/bin/* usr/bin; rm -rf usr/local/bin
fi
if [[ -e usr/local/sbin ]]; then
	mkdir usr/bin 2> /dev/null; mv usr/local/sbin/* usr/bin; rm -rf usr/local/sbin
fi
if [[ -e usr/share/applications ]]; then
	ls usr/share/applications/*.desktop | while read line; do
		sed -i -e s'/^Exec=\/bin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/sbin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/sbin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/games\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/local\/bin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/local\/sbin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/local\/games\//Exec=\/usr\/bin\//g' "$line" 2> /dev/null
	done
fi
if [[ $pseudo != set ]]; then
	if [[ -e lib ]]; then
		mkdir -p usr/lib 2> /dev/null; mv lib/* usr/lib; rm -rf lib
	fi
	if [[ -e lib32 ]]; then
		if [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
			mkdir -p usr/lib 2> /dev/null; mv lib32/* usr/lib; rm -rf lib32
		else
			mkdir -p usr/lib32 2> /dev/null; mv lib32/* usr/lib32; rm -rf lib32
		fi
	fi
	if [[ -e lib64 ]]; then
		mkdir -p usr/lib 2> /dev/null; mv lib64/* usr/lib; rm -rf lib64
	fi
	if [[ -e usr/lib32 ]] && [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
		mkdir usr/lib 2> /dev/null; mv usr/lib32/* usr/lib; rm -rf usr/lib32
	fi
	if [[ -e usr/lib64 ]]; then
		mkdir usr/lib 2> /dev/null; mv usr/lib64/* usr/lib; rm -rf usr/lib64
	fi
	if [[ -e usr/local/lib32 ]] && [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
		mkdir usr/local/lib 2> /dev/null; mv usr/local/lib32/* usr/local/lib; rm -rf usr/local/lib32
	fi
	if [[ -e usr/local/lib64 ]]; then
		mkdir usr/local/lib 2> /dev/null; mv usr/local/lib64/* usr/local/lib; rm -rf usr/local/lib64
	fi
else
	if [[ -e lib ]]; then
		mkdir -p usr/lib32 2> /dev/null; mv lib/* usr/lib32; rm -rf lib
	fi
	if [[ -e lib32 ]]; then
		mkdir -p usr/lib32 2> /dev/null; mv lib32/* usr/lib32; rm -rf lib32
	fi
	if [[ -e usr/lib ]]; then
		mkdir usr/lib32 2> /dev/null; mv usr/lib/* usr/lib32; rm -rf usr/lib
	fi
	if [[ -e usr/local/lib ]]; then
		mkdir usr/local/lib32 2> /dev/null; mv usr/local/lib/* usr/local/lib32; rm -rf usr/local/lib
	fi
fi

if [[ $pkgbuild == set ]] || [[ $Pkgbuild == set ]]; then
	if [[ -e usr/local ]] && [[ ! $(ls -A usr/local 2> /dev/null) ]]; then
		echo 'rm -rf usr/local' >> pkgbuildinstallations2
	fi
fi

if [[ -e usr/local ]] && [[ ! $(ls -A usr/local 2> /dev/null) ]]; then
	rm -rf usr/local
fi

# Generating .PKGINFO file
echo -e "${lightgreen}==>${NC} ${bold}Generating .PKGINFO file...${normal}"

# Generating pkgname field
if [[ $pseudo == set ]] && [[ $(ls -A usr/lib32 2> /dev/null) ]] && [[ ! $(ls -A usr/bin 2> /dev/null) ]]; then
	for i in {git,bzr,darcs,hg}; do
		if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
			echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-$i | sed s"/-$i-$i$/-$i/" | sed s'/--/-/g' > .PKGINFO
		fi
	done
	if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q svn; echo $?) == 0 ]]; then
		echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-svn | sed s'/-svn-svn$/-svn/' | sed s'/--/-/g' > .PKGINFO
	fi
	for i in {cvs,CVS}; do
		if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
			echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-cvs | sed s'/-cvs-cvs$/-cvs/' | sed s'/--/-/g' > .PKGINFO
		fi
	done
	if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
		echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`" | sed s'/--/-/g' > .PKGINFO
	fi
else
	for i in {git,bzr,darcs,hg}; do
		if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
			echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-$i | sed s"/-$i-$i$/-$i/" | sed s'/--/-/g' > .PKGINFO
		fi
	done
	if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q svn; echo $?) == 0 ]]; then
		echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-svn | sed s'/-svn-svn$/-svn/' | sed s'/--/-/g' > .PKGINFO
	fi
	for i in {cvs,CVS}; do
		if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
			echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-cvs | sed s'/-cvs-cvs$/-cvs/' | sed s'/--/-/g' > .PKGINFO
		fi
	done
	if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
		echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`" | sed s'/demo$/-demo/' | sed s'/trial$/-trial/' | sed s'/--/-/g' > .PKGINFO
	fi
fi

# Generating pkgver field
version=$(grep -i ^Version: control | gawk '{print $2}' | sed -e s'/[+~]/-/g' -e s'/[-._]alpha/alpha/' -e s'/[-._]beta/beta/' -e s'/[-._]pre/pre/' -e s'/[-._]rc/rc/' -e s'/[-._]dfsg/dfsg/' | gawk -F 'dev' '{print $1}' | sed -e s'/-\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+\.[0-9]\+//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]*[a-z]*[0-9]*//g' -e s'/--/-/g' -e s'/\.\././g' | sed s'/\.$//')
for i in {git,bzr,darcs,hg}; do
    if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
		echo "pkgver = `echo $version | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
    fi
done
for i in {svn.r,svnr}; do
    if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
		echo "pkgver = r`echo $version | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
    fi
done
if [[ $(echo $version | grep -q svn; echo $?) == 0 ]] && [[ $(echo $version | grep -q "svn\.r\|svnr"; echo $?) != 0 ]]; then
    echo "pkgver = `echo $version | gawk -F 'svn' '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
fi
for i in {cvs,CVS}; do
    if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
		echo "pkgver = `echo $version | sed -e s"/[-.]$i/ /g" -e s"/$i/ /g" -e s"/-/ /g" | gawk '{print $2}'`"-1 >> .PKGINFO
    fi
done
if [[ $(echo $version | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
    echo "pkgver = `echo $version | gawk -F '-[0-9]' '{print $1}' | sed s'/-/./'`"-1 >> .PKGINFO
fi

# Generating pkgdesc field
if [[ $(echo `grep -v ":\| \." control` | grep -iq "`grep -i ^Description: control | sed s'/^Description: //i' | sed s'/\.//'`"; echo $?) == 0 ]]; then
    description=$(echo $(echo "`grep -v ":\| \." control`") | sed s'/^\s*./\U&\E/g' | sed s'/\(\. \|\! \|\? \)\s*./\U&\E/g')
else
    description=$(echo $(echo "`grep -i ^Description: control | sed s'/^Description: //i' | sed 's/.*/\u&/'`" | sed s'/\.//'). `grep -v ":\| \." control` | sed s'/^\s*./\U&\E/g' | sed s'/\(\. \|\! \|\? \)\s*./\U&\E/g')
fi
echo "pkgdesc = $description" >> .PKGINFO

# Generating url field
echo "url = `grep -i ^Homepage: control | gawk '{print $2}'`" | sed s'/\/$//' >> .PKGINFO

# Generating builddate (which is actually packaging date) field
echo "builddate = `date -u "+%s"`" >> .PKGINFO

# Generating packager field
if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
    echo "packager = Unknown Packager" >> .PKGINFO
else
    source /usr/share/makepkg/util/config.sh
    load_makepkg_config
    echo -e "\n${lightblue}::${NC} Enter Packager name:"
    read -e -i "${PACKAGER}" packager_name
    echo "packager = $packager_name" >> .PKGINFO
fi

# Generating arch field
if [[ $pseudo != set ]]; then
	echo "arch = `grep -i ^Architecture: control | gawk '{print $2}' | sed -e s'/i386/i686/' -e s'/amd64/x86_64/' -e s'/armhf/armv7h/' -e s'/arm64/aarch64/' -e s'/all/any/'`" >> .PKGINFO
else
	echo "arch = x86_64" >> .PKGINFO
fi

# Generating size field
if [[ -e preinst ]]; then
    preinst_size=$(ls -l | grep preinst | gawk '{print $5}')
else
    preinst_size=0
fi
if [[ -e postinst ]]; then
    postinst_size=$(ls -l | grep postinst | gawk '{print $5}')
else
    postinst_size=0
fi
if [[ -e prerm ]]; then
    prerm_size=$(ls -l | grep prerm | gawk '{print $5}')
else
    prerm_size=0
fi
if [[ -e postrm ]]; then
    postrm_size=$(ls -l | grep postrm | gawk '{print $5}')
else
    postrm_size=0
fi
if [[ -e conffiles ]]; then
    conffiles_size=$(ls -l | grep conffiles | gawk '{print $5}')
else
    conffiles_size=0
fi
if [[ -e pkgbuildinstallations1 ]]; then
    pkgbuildinstallations1_size=$(ls -l | grep pkgbuildinstallations1 | gawk '{print $5}')
else
    pkgbuildinstallations1_size=0
fi
if [[ -e pkgbuildinstallations2 ]]; then
    pkgbuildinstallations2_size=$(ls -l | grep pkgbuildinstallations2 | gawk '{print $5}')
else
    pkgbuildinstallations2_size=0
fi
if [[ -e pkgbuildinstallations32 ]]; then
    pkgbuildinstallations32_size=$(ls -l | grep pkgbuildinstallations32 | gawk '{print $5}')
else
    pkgbuildinstallations32_size=0
fi
if [[ -e pkgbuildinstallations64 ]]; then
    pkgbuildinstallations64_size=$(ls -l | grep pkgbuildinstallations64 | gawk '{print $5}')
else
    pkgbuildinstallations64_size=0
fi
echo "size =" $((`du -sb | tr -d " ."` - `ls -l | grep control | gawk '{print $5}'` - $preinst_size - $postinst_size - $prerm_size - $postrm_size - $conffiles_size - $pkgbuildinstallations1_size - $pkgbuildinstallations2_size - $pkgbuildinstallations32_size - $pkgbuildinstallations64_size - `ls -la | grep .PKGINFO | gawk '{print $5}'` - 4096)) >> .PKGINFO

# Generating license field
if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
    echo "license = custom" >> .PKGINFO
else
    echo -e "\n${lightblue}::${NC} Enter package license (you can enter multiple licenses comma separated):"
    read package_license
    for i in `echo "$package_license" | sed -e s'/ /__/g' -e s'/,/ /g'`; do
		license+=($i)
    done
    for (( i=0; i<$(echo ${#license[@]}); i=i+1 )); do
        license[$i]=$(echo ${license[$i]} | sed s'/__/ /g')
    done
    printf '%s\n' "${license[@]}" | while read line; do
        echo "license = $line" >> .PKGINFO
    done
fi

echo -e "\n${lightgreen}***${NC} ${bold}Creation of .PKGINFO file in progress. It may take a few minutes, please wait...${normal}"

# The packages names translator function
packages-names-translator() {
# First method of translating .deb packages names into Arch Linux packages names, more accurate, comparing contents of .deb packages with Arch Linux packages contents
for debian_package_name in $(gawk '{print $1}' `ls | grep initial-check-list`); do
	for debian_package_file in `grep "\/$debian_package_name$" /var/cache/debtap/debian-main-packages-files /var/cache/debtap/debian-non-free-packages-files /var/cache/debtap/debian-contrib-packages-files | grep 'bin\|opt\|\.so' | gawk '{print $1}' | sed s'/\// /g' | gawk '{print $NF}'`; do
		echo $debian_package_file $(grep "^$debian_package_name$\|^$debian_package_name " `ls | grep initial-check-list` | gawk '{print $2}')
	done >> $debian_package_name-tempfile03
done

for i in `ls | grep tempfile03`; do
    for j in `gawk '{print $1}' $i`; do
		for k in `pkgfile -q $j`; do
			echo $k`head -1 $i | gawk '{print $2$3}'`
		done
    done >> `echo $i | sed s'/tempfile03/tempfile04/'`
done

touch tempfile05
for debian_package_name in $(gawk '{print $1}' `ls | grep initial-check-list`); do
    grep -q "^$debian_package_name$" tempfile05 || echo $debian_package_name >> tempfile05
done

for i in $(for j in `cat tempfile05`; do echo $j-tempfile04; done); do
    k=`sort $i | uniq -c | gawk '{print $1}' | sort -n | tail -1`
    if [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -ge 2 ]]; then
		for l in `cat $i`; do
			for m in $(sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}'); do
				echo $l | grep "^$m$"
			done
		done | head -1 >> tempfile06
    elif [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -eq 1 ]]; then
		sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}' >> tempfile06
    else
		echo >> tempfile06
    fi
done

cat tempfile06 | sed s'/=/ = /g' | sed s'/>/ > /g' | sed s'/</ < /g' | sed s'/>  =/>=/g' | sed s'/<  =/<=/g' | sed s'/^lib32-\|-multilib$//g' > tempfile07

cat tempfile07 | while read line; do
    if [[ $(echo "$line" | wc -w) -eq 0 ]]; then
		echo >> final-check-list
    elif [[ $(echo "$line" | wc -w) -eq 1 ]] || [[ $(echo "$line" | wc -w) -eq 3 ]]; then
		echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
    elif [[ $(echo "$line" | wc -w) -eq 5 ]]; then
		echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
		echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $4}'` `echo "$line" | gawk '{print $5}'`" >> final-check-list
    fi
done

for i in $(eval echo {1..$(cat `ls | grep initial-check-list` | wc -l)}); do
    if [[ $(sed -n ""$i"{p;q;}" final-check-list | gawk '{print $1}') == "" ]]; then
		echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list`) >> untranslated
		echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list` | gawk '{print $1}') >> untranslated-names-only
    elif [[ $(echo " $(echo $(grep ^pkgname .PKGINFO | gawk '{print $3}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//'){-svn,-git,-cvs,-bzr,-darcs,-hg,}) " | grep -q " $(sed -n ""$i"{p;q;}" final-check-list | gawk '{print $1}') "; echo $?) == 0 ]]; then
		echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list` | sed s'/ //') >> missing-files
    fi
done

# Second method of translating remaining untranslated .deb packages names into Arch Linux packages names, same as first method, but searches in Ubuntu database for packages contents instead of Debian database
if [[ -e untranslated-names-only ]]; then
    for ubuntu_package_name in $(sort -u untranslated-names-only); do
		for ubuntu_package_file in `grep "\/$ubuntu_package_name$" /var/cache/debtap/ubuntu-packages-files | grep 'bin\|opt\|\.so' | gawk '{print $1}' | sed s'/\// /g' | gawk '{print $NF}'`; do
			echo $ubuntu_package_file $(grep "^$ubuntu_package_name$\|^$ubuntu_package_name " untranslated | gawk '{print $2}')
		done >> $ubuntu_package_name-tempfile08
    done

    for i in `ls | grep tempfile08`; do
		for j in `gawk '{print $1}' $i`; do
			for k in `pkgfile -q $j`; do
				echo $k`head -1 $i | gawk '{print $2$3}'`
			done
		done >> `echo $i | sed s'/tempfile08/tempfile09/'`
    done

    touch tempfile10
    for ubuntu_package_name in $(sort -u untranslated-names-only); do
		grep -q "^$ubuntu_package_name$" tempfile10 || echo $ubuntu_package_name >> tempfile10
    done

    for i in $(for j in `cat tempfile10`; do echo $j-tempfile09; done); do
		k=`sort $i | uniq -c | gawk '{print $1}' | sort -n | tail -1`
		if [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -ge 2 ]]; then
			for l in `cat $i`; do
				for m in $(sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}'); do
					echo $l | grep "^$m$"
				done
			done | head -1 >> tempfile11
		elif [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -eq 1 ]]; then
			sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}' >> tempfile11
		else
			echo >> tempfile11
		fi
    done

    cat tempfile11 | sed s'/=/ = /g' | sed s'/>/ > /g' | sed s'/</ < /g' | sed s'/>  =/>=/g' | sed s'/<  =/<=/g' | sed s'/^lib32-\|-multilib$//g' > tempfile12

    cat tempfile12 | while read line; do
		if [[ $(echo "$line" | wc -w) -eq 0 ]]; then
			echo >> final-check-list
		elif [[ $(echo "$line" | wc -w) -eq 1 ]] || [[ $(echo "$line" | wc -w) -eq 3 ]]; then
			echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
		elif [[ $(echo "$line" | wc -w) -eq 5 ]]; then
			echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
			echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $4}'` `echo "$line" | gawk '{print $5}'`" >> final-check-list
		fi
    done

    for i in $(eval echo {1..$(cat untranslated | wc -l)}); do
		if [[ $(tac final-check-list | sed -n ""$i"{p;q;}" | gawk '{print $1}') == "" ]]; then
			echo $(tac untranslated | sed -n ""$i"{p;q;}") >> new-untranslated
			echo $(tac untranslated | sed -n ""$i"{p;q;}" | gawk '{print $1}') >> new-untranslated-names-only
		elif [[ $(echo " $(echo $(grep ^pkgname .PKGINFO | gawk '{print $3}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//'){-svn,-git,-cvs,-bzr,-darcs,-hg,}) " | grep -q " $(tac final-check-list | sed -n ""$i"{p;q;}" | gawk '{print $1}') "; echo $?) == 0 ]]; then
			echo $(tac untranslated | sed -n ""$i"{p;q;}" | sed s'/ //') >> missing-files
		fi
    done

    rm -rf untranslated untranslated-names-only
fi

# Third method of translating remaining untranslated .deb packages names into Arch Linux packages names, less accurate, comparing .deb packages names with Arch Linux packages names
if [[ -e new-untranslated-names-only ]]; then
    for i in $(sort -u new-untranslated-names-only | grep -v python-support); do

	j=$(echo "$i" | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//')

	pacman -Ssq $(echo "$j" | sed s'/^lib//') | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' > result1
	grep -q "^$j$" result1 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" > matches
	grep -q "^$(echo "$j" | sed s'/^lib//')$" result1 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' >> matches

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $4}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/-/ /g' | gawk '{print $5}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n + $o + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do 
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o - 1))} $(($k + $l + $m + $n + $o + 1))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 4))} $(($k + $l + $m + $n + $o - 2))); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 3))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o - 1))} $(($k + $l + $m + $n + $o + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/[a-z]/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/-/ /g' | gawk '{print $4}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 4))} $(($k + $l + $m + $n + $o - 2))); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 3))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[a-z]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $4}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/[a-z]/ /g' | gawk '{print $4}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 3))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[a-z]\+[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/[a-z]/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /' | sed s'/\./ /g' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/[a-z]/ /g' | gawk '{print $4}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n + $o - 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 3))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | sed s'/\./ /' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed s'/\./ /' | sed s'/-/ /g' | gawk '{print $4}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n + $o + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n - 1))} {$(($k + $m + $n + 1))..$(($k + $m + $n + $o - 1))} $(($k + $m + $n + $o + 1))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 2))} $(($k + $m + $n + $o))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n - 1))} {$(($k + $m + $n + 1))..$(($k + $m + $n + $o))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n + $o - 2))} $(($k + $m + $n + $o))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 3))} $(($k + $m + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n - 1))} {$(($k + $m + $n + 1))..$(($k + $m + $n + $o - 1))} $(($k + $m + $n + $o + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n - 1))} {$(($k + $m + $n + 1))..$(($k + $m + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n + $o - 2))} $(($k + $m + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | sed s'/\./ /' | gawk '{print $2}' | wc -c)
	    o=$(echo "$j" | rev | sed s'/\./ /' | sed s'/-/ /g' | gawk '{print $3}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 2))} $(($k + $m + $n + $o))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 3))} $(($k + $m + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 2))} $(($k + $m + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 3))} $(($k + $m + $n + $o - 1))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[a-z]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | sed s'/\./ /' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed s'/\./ /' | sed s'/[a-z]/ /g' | gawk '{print $3}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n - 1))} {$(($k + $m + $n + 1))..$(($k + $m + $n + $o))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n - 1))} {$(($k + $m + $n + 1))..$(($k + $m + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /' -e s'/\./ /' | gawk '{print $2}' | wc -c)
	    o=$(echo "$j" | rev | sed s'/\./ /' | sed s'/[a-z]/ /g' | gawk '{print $3}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n + $o - 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[a-z]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $3}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} $(($k + $l + $m + $n + 1))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} $(($k + $l + $m + $n))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} $(($k + $l + $m + $n))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} $(($k + $l + $m + $n - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} $(($k + $l + $m + $n + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[a-z]\+[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/[a-z]/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} $(($k + $l + $m + $n))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} $(($k + $l + $m + $n - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} $(($k + $l + $m + $n))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[a-z]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[a-z]\+[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/[a-z]/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /' | sed s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n - 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 1))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[a-z]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $3}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n - 1))} $(($k + $m + $n + 1))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} $(($k + $m + $n))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n - 1))} $(($k + $m + $n + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} $(($k + $m + $n))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} $(($k + $m + $n))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[a-z]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m + 1))..$(($k + $m + $n))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /' | sed s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n - 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+\.[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/-/ /g' | gawk '{print $4}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 2))} $(($k + $m + $n + $o))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 3))} $(($k + $m + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 2))} $(($k + $m + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 3))} $(($k + $m + $n + $o - 1))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[a-z]\+\.[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /' | sed s'/\./ /g' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/[a-z]/ /g' | gawk '{print $3}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n + $o - 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} {$(($k + $m + $n))..$(($k + $m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n + $o - 2))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[a-z]\+\.[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} $(($k + $m + $n))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 2))} $(($k + $m + $n))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[a-z]\+\.[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /' | sed s'/[a-z]/ /g' | gawk '{print $3}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + $n - 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $m))..$(($k + $m + $n - 1))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | sed s'/\./ /' | gawk '{print $2}' | wc -c)
	    o=$(echo "$j" | rev | sed s'/\./ /' | sed s'/-/ /g' | gawk '{print $3}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + $n + $o + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o - 1))} $(($m + $n + $o + 1))); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p" >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p" >> matches
	    done
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p" >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 2))} $(($m + $n + $o))); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p" >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p" >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o - 1))} $(($m + $n + $o + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 2))} $(($m + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /' -e s'/\./ /' | gawk '{print $2}' | wc -c)
	    o=$(echo "$j" | rev | sed s'/\./ /' | sed s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o))}); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p" >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p" >> matches
	    done
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p" >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + $n + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} $(($m + $n + 1))); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p" >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p" >> matches
	    done
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p" >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} $(($m + $n + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /' | sed s'/[a-z]/ /g' | gawk '{print $1}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for r in $(eval echo {$(($m + 1))..$(($m + $n))}); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p" >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p" >> matches
	    done
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+\.[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/-/ /g' | gawk '{print $4}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + $n + $o + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o - 1))} $(($m + $n + $o + 1))); do
	        grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p" >> matches
	        grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p" >> matches
	    done
	    if [[ ! -e matches ]]; then
	        for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p" >> matches
	        done
	    fi
	    if [[ ! -e matches ]]; then
	        for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 2))} $(($m + $n + $o))); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p" >> matches
	        done
	    fi
	    if [[ ! -e matches ]]; then
	        for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p" >> matches
	        done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o - 1))} $(($m + $n + $o + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 2))} $(($m + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[a-z]\+\.[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /' | sed s'/\./ /g' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o))}); do
	        grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p" >> matches
	        grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p" >> matches
	    done
	    if [[ ! -e matches ]]; then
	        for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p" >> matches
	        done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} {$(($m + $n + 1))..$(($m + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[a-z]\+\.[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + $n + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} $(($m + $n + 1))); do
	        grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p" >> matches
	        grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p" >> matches
	    done
	    if [[ ! -e matches ]]; then
	        for r in $(eval echo {$(($m + 1))..$(($m + $n))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p" >> matches
	        done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n - 1))} $(($m + $n + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[a-z]\+\.[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /' | sed s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    p=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | rev)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for r in $(eval echo {$(($m + 1))..$(($m + $n))}); do
	        grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p" >> matches
	        grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p" >> matches
	    done
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($m + 1))..$(($m + $n))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[a-z]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $q- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $q- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $q- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		grep -q "^$(echo "$j" | rev | cut -c $(($k + $l + $m + 1))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $(($k + $l + $m + 1))- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + 1))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + 1))- | rev >> matches
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[a-z]\+[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/[a-z]/ /' | gawk '{print $2}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $q- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		grep -q "^$(echo "$j" | rev | cut -c $(($k + $l + $m))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $(($k + $l + $m))- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m))- | rev >> matches
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[a-z]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $q- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		grep -q "^$(echo "$j" | rev | cut -c $(($k + $m + 1))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $(($k + $m + 1))- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + 1))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m + 1))- | rev >> matches
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	    if [[ ! -e matches ]]; then
		grep -q "^$(echo "$j" | rev | cut -c $(($k + $m))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $(($k + $m))- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m))- | rev >> matches
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[a-z]\+\.[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		grep -q "^$(echo $(echo "$j" | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	    if [[ ! -e matches ]]; then
		grep -q "^$(echo "$j" | rev | cut -c $(($k + $m))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $(($k + $m))- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $m))- | rev >> matches
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    grep -q "^$(echo "$j" | rev | cut -c $(($m + 1))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $(($m + 1))- | rev >> matches
	    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + 1))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + 1))- | rev >> matches
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[a-z]\+\.[a-z]\+$"; echo $?) == 0 ]]; then
	    m=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    grep -q "^$(echo "$j" | rev | cut -c $(($m + 1))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $(($m + 1))- | rev >> matches
	    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + 1))- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $(($m + 1))- | rev >> matches
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/-/ /g' | gawk '{print $4}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $n + $o + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do 
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n - 1))} {$(($k + $l + $n + 1))..$(($k + $l + $n + $o - 1))} $(($k + $l + $n + $o + 1))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n - 1))} {$(($k + $l + $n + 1))..$(($k + $l + $n + $o))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n - 2))} {$(($k + $l + $n))..$(($k + $l + $n + $o - 2))} $(($k + $l + $n + $o))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n - 2))} {$(($k + $l + $n))..$(($k + $l + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n + $o - 2))} $(($k + $l + $n + $o))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n + $o - 3))} $(($k + $l + $n + $o - 1))); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n - 1))} {$(($k + $l + $n + 1))..$(($k + $l + $n + $o - 1))} $(($k + $l + $n + $o + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n - 1))} {$(($k + $l + $n + 1))..$(($k + $l + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n + $o - 2))} $(($k + $l + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $3}' | wc -c)
	    o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/[a-z]/ /g' | gawk '{print $3}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n - 1))} {$(($k + $l + $n + 1))..$(($k + $l + $n + $o))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n - 2))} {$(($k + $l + $n))..$(($k + $l + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n + $o - 2))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n - 1))} {$(($k + $l + $n + 1))..$(($k + $l + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | sed s'/\./ /' | gawk '{print $2}' | wc -c)
	    o=$(echo "$j" | rev | sed s'/\./ /' | sed s'/-/ /g' | gawk '{print $3}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $n + $o + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		for r in $(eval echo {$(($k + 1))..$(($k + $n - 1))} {$(($k + $n + 1))..$(($k + $n + $o - 1))} $(($k + $n + $o + 1))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + 1))..$(($k + $n - 1))} {$(($k + $n + 1))..$(($k + $n + $o))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + 1))..$(($k + $n + $o - 2))} $(($k + $n + $o))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + 1))..$(($k + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n - 1))} {$(($k + $n + 1))..$(($k + $n + $o - 1))} $(($k + $n + $o + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n - 1))} {$(($k + $n + 1))..$(($k + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n + $o - 2))} $(($k + $n + $o))); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | sed s'/\./ /' | gawk '{print $2}' | wc -c)
	    o=$(echo "$j" | rev | sed s'/\./ /' | sed s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		for r in $(eval echo {$(($k + 1))..$(($k + $n - 1))} {$(($k + $n + 1))..$(($k + $n + $o))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + 1))..$(($k + $n + $o - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n - 1))} {$(($k + $n + 1))..$(($k + $n + $o))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n + $o - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $n + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n - 1))} $(($k + $l + $n + 1))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		    for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n - 2))} $(($k + $l + $n))); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n - 1))} $(($k + $l + $n + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    for r in $(eval echo {$(($k + $l))..$(($k + $l + $n - 1))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + $l + 1))..$(($k + $l + $n))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $n + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		for r in $(eval echo {$(($k + 1))..$(($k + $n - 1))} $(($k + $n + 1))); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))}); do
		    for r in $(eval echo {$(($k + 1))..$(($k + $n))}); do
			grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
			grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    done
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n - 1))} $(($k + $n + 1))); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/[a-z]/ /g' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $n))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		for r in $(eval echo {$(($k + 1))..$(($k + $n))}); do
		    grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		    grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
		done
	    done
	    if [[ ! -e matches ]]; then
		for r in $(eval echo {$(($k + 1))..$(($k + $n))}); do
		    grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
		grep -q "^$(echo "$j" | rev | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $q- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 2))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $q- | rev >> matches
		done
	    fi
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $q- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
	    l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/[a-z]/ /' | gawk '{print $2}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
		grep -q "^$(echo "$j" | rev | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$(($k + $l - 1))}); do
		    grep -q "^$(echo "$j" | rev | sed 's/\.//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $q- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+-[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$(($k - 1))}); do
		grep -q "^$(echo "$j" | rev | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	    if [[ ! -e matches ]]; then
		for q in $(eval echo {1..$k}); do
		    grep -q "^$(echo "$j" | rev | sed 's/-//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//1' | cut -c $q- | rev >> matches
		    grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $q- | rev >> matches
		done
	    fi
	fi

	if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+$"; echo $?) == 0 ]]; then
	    k=$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | wc -c)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $k- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
	    for q in $(eval echo {1..$k}); do
		grep -q "^$(echo "$j" | rev | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $q- | rev >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $q- | rev >> matches
	    done
	fi

	if [[ ! -e matches ]]; then
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | sed s'/[0-9]\|\.\|-/ /g') | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' > result3
	    grep -q "^$(echo "$j" | sed -e s'/[0-9]\|\.//g' -e s'/-\+/-/g' -e s'/-$//g')$" result3 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed -e s'/[0-9]\|\.//g' -e s'/-\+/-/g' -e s'/-$//g' >> matches
	    grep -q "^$(echo "$j" | sed s'/^lib//' | sed -e s'/[0-9]\|\.//g' -e s'/-\+/-/g' -e s'/-$//g')$" result3 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | sed -e s'/[0-9]\|\.//g' -e s'/-\+/-/g' -e s'/-$//g' >> matches
	fi

	if [[ ! -e matches ]]; then
	    word_count=$(echo "$j" | sed s'/^lib//' | sed s'/[0-9]\|\.\|-/ /g' | wc -w)
	    pacman -Ssq $(echo "$j" | sed s'/^lib//' | sed s'/[0-9]\|\.\|-/ /g' | gawk '{print $1}') | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' > result3
	    for s in $(eval echo {$word_count..1}); do
		grep -q "^$(echo "$j" | sed -e s'/[0-9]\|\.\|-/ /g' -e s'/ \+/ /g' | cut -d ' ' -f1-$s | sed s'/ /-/g')$" result3 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed -e s'/[0-9]\|\.\|-/ /g' -e s'/ \+/ /g' | cut -d ' ' -f1-$s | sed s'/ /-/g' >> matches
		grep -q "^$(echo "$j" | sed s'/^lib//' | sed -e s'/[0-9]\|\.\|-/ /g' -e s'/ \+/ /g' | cut -d ' ' -f1-$s | sed s'/ /-/g')$" result3 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | sed -e s'/[0-9]\|\.\|-/ /g' -e s'/ \+/ /g' | cut -d ' ' -f1-$s | sed s'/ /-/g' >> matches
	    done
	fi

	if [[ -e matches ]] && [[ $(grep ^pkgname .PKGINFO | gawk '{print $3}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | grep -q "^$(head -1 matches)$"; echo $?) != 0 ]]; then
	    for t in {svn,git,cvs,bzr,darcs,hg}; do
		if [[ $(echo "$i" | grep -q "\-$t$"; echo $?) == 0 ]]; then
		    grep "^$i$\|^$i " new-untranslated | sed s"/^$i/$(head -1 matches)-$t/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
		fi
	    done
	    if [[ $(echo "$i" | grep -q '\-svn$\|\-git$\|\-cvs$\|\-bzr$\|\-darcs$\|\-hg$'; echo $?) != 0 ]]; then
	        grep "^$i$\|^$i " new-untranslated | sed s"/^$i/$(head -1 matches)/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
	    fi
	    sed -i "/^$i$\|^$i /d" new-untranslated
	fi

	rm -rf matches result*
    done

    rm -rf new-untranslated-names-only
fi

# Appending untranslated packages names (if any exist) to the translated packages names list
if [[ $(cat new-untranslated 2> /dev/null | wc -l) -ne 0 ]]; then
    tac new-untranslated | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
    gawk '{print $1}' new-untranslated | sort -u > $(echo `ls | grep initial-check-list` | sed s'/initial-check-list/untranslated-names-only/')
fi
rm -rf new-untranslated

# Sorting packages with missing files (if any exist)
if [[ -e missing-files ]]; then
    sort -u missing-files > $(echo `ls | grep initial-check-list` | sed s'/initial-check-list/missing-files/')
    rm -rf missing-files
fi

# Special rules for optional dependencies
if [[ -e optional-dependencies-untranslated-names-only ]]; then
    if [[ -e dependencies-untranslated-names-only ]]; then
        for i in `cat optional-dependencies-untranslated-names-only`; do
            if [[ $(grep -q "^$i$" dependencies-untranslated-names-only; echo $?) != 0 ]]; then
                echo "$i" >> optional-dependencies-untranslated-names-only-1
            fi
        done
        rm -rf optional-dependencies-untranslated-names-only
    else
        mv optional-dependencies-untranslated-names-only optional-dependencies-untranslated-names-only-1
    fi
fi

# Appending ready translated names (if any needed) to the translated packages names list
grep -q "^fonts-freefont-ttf$\|^fonts-freefont-ttf " tempfile02 && echo ttf-freefont >> final-check-list
grep -q "^fonts-liberation$\|^fonts-liberation " tempfile02 && echo ttf-liberation >> final-check-list
grep -q "^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer " tempfile02 && echo ttf-ms-fonts >> final-check-list
grep -q "^default-jre$\|^default-jre " tempfile02 && echo java-runtime >> final-check-list
grep -q "^python:any$\|^python:any " tempfile02 && echo python >> final-check-list
grep "^openjdk-[0-9]+-jdk$\|^openjdk-[0-9]+-jdk " tempfile02 | sort -uV | tail -1 | sed s"/openjdk-\([0-9]\+\)-jdk/jdk\1-openjdk/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^openjdk-[0-9]+-jre\(-headless\)\?$\|^openjdk-[0-9]+-jre\(-headless\)\? " tempfile02 | sort -uV | tail -1 | sed s"/openjdk-\([0-9]\+\)-jre/jre\1-openjdk/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^libstdc[0-9]+$\|libstdc[0-9]+ " tempfile02 | sort -uV | tail -1 | sed s"/libstdc\([0-9]\+\)/$(pacman -Ssq libstdc | sort -uV | tail -1)/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^qt[0-9]+-default$\|qt[0-9]+-default " tempfile02 | sed s"/qt\([0-9]\+\)-default/qt\1-base/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
if [[ $pseudo != set ]]; then
	grep -q "^xlibs$\|^xlibs " tempfile02 && echo libx11 >> final-check-list
	grep -q "^libgl1$\|^libgl1 " tempfile02 && echo libgl >> final-check-list
	grep -q "^libglu1$\|^libglu1 " tempfile02 && echo glu >> final-check-list
	grep "^libpango$\|^libpango " tempfile02 | sed s"/libpango/pango/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
	grep "^libpangomm$\|^libpangomm " tempfile02 | sed s"/libpangomm/pangomm/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
	grep "^libcupsys2$\|^libcupsys2 " tempfile02 | sed s"/libcupsys2/libcups/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
	grep "^jackd[0-9]*$\|^jackd-[0-9]* " tempfile02 | sort -uV | tail -1 | sed s"/jackd\([0-9]\*\)/jack\1/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
else
	grep -q "^xlibs$\|^xlibs " tempfile02 && echo lib32-libx11 >> final-check-list
	grep -q "^libgl1$\|^libgl1 " tempfile02 && echo lib32-libgl >> final-check-list
	grep -q "^libglu1$\|^libglu1 " tempfile02 && echo lib32-glu >> final-check-list
	grep "^libpango$\|^libpango " tempfile02 | sed s"/libpango/lib32-pango/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
	grep "^libpangomm$\|^libpangomm " tempfile02 | sed s"/libpangomm/lib32-pangomm/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
	grep "^libcupsys2$\|^libcupsys2 " tempfile02 | sed s"/libcupsys2/lib32-libcups/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
	grep "^jackd[0-9]*$\|^jackd-[0-9]* " tempfile02 | sort -uV | tail -1 | sed s"/jackd\([0-9]\*\)/lib32-jack\1/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
fi

# Stripping unnecessary symbols and words from packages versions
grep -v "^$" final-check-list | while read line; do
    echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | sed s'/^[^:]*://' | sed -e s'/[+~]/-/g' -e s'/[-._]alpha/alpha/' -e s'/[-._]beta/beta/' -e s'/[-._]pre/pre/' -e s'/[-._]rc/rc/' -e s'/[-._]dfsg/dfsg/' | gawk -F 'dev' '{print $1}' | sed -e s'/-\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+\.[0-9]\+//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]*[a-z]*[0-9]*//g' -e s'/--/-/g' -e s'/\.\././g' | sed s'/\.$//'`" >> tempfile13
done

# Special rules for version control systems
cat tempfile13 | while read line; do
    for i in {git,bzr,darcs,hg}; do
		if [[ $(echo "$line" | gawk '{print $3}' | grep -q $i; echo $?) == 0 ]]; then
			echo "$(echo `echo "$line" | gawk '{print $1}'`-$i | sed s"/-$i-$i$/-$i/") `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`" >> tempfile14
		fi
    done
    for i in {svn.r,svnr}; do
		if [[ $(echo "$line" | gawk '{print $3}' | grep -q $i; echo $?) == 0 ]]; then
			echo "$(echo `echo "$line" | gawk '{print $1}'`-svn | sed s'/-svn-svn$/-svn/') `echo "$line" | gawk '{print $2}'` r`echo "$line" | gawk '{print $3}' | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`" >> tempfile14
		fi
    done
    if [[ $(echo "$line" | gawk '{print $3}' | grep -q svn; echo $?) == 0 ]] && [[ $(echo "$line" | gawk '{print $3}' | grep -q "svn\.r\|svnr"; echo $?) != 0 ]]; then
		echo "$(echo `echo "$line" | gawk '{print $1}'`-svn | sed s'/-svn-svn$/-svn/') `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | gawk -F 'svn' '{print $2}' | gawk -F '-' '{print $1}'`" >> tempfile14
    fi
    for i in {cvs,CVS}; do
		if [[ $(echo "$line" | gawk '{print $3}' | grep -q $i; echo $?) == 0 ]]; then
			echo "$(echo `echo "$line" | gawk '{print $1}'`-cvs | sed s'/-cvs-cvs$/-cvs/') `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | sed -e s"/[-.]$i/ /g" -e s"/$i/ /g" -e s"/-/ /g" | gawk '{print $2}'`" >> tempfile14
		fi
    done
    if [[ $(echo "$line" | gawk '{print $3}' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
		echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | gawk -F '-[0-9]' '{print $1}' | sed s'/-/./'`" >> tempfile14
    fi
done

if [[ $pseudo != set ]]; then
	mv tempfile14 tempfile15
else
	# Special rules for multilib packages
	cat tempfile14 | while read line; do
		i=$(echo "$line" | gawk '{print $1}')
		pacman -Ssq "lib32-$i" > result
		grep -q "^lib32-$i$" result /var/cache/debtap/aur-packages && echo "$line" | sed s"/^$i/lib32-$i/" >> tempfile15
		grep -q "^lib32-$i$" result /var/cache/debtap/aur-packages || echo "$line" >> tempfile15
	done
	rm -rf result
fi

# Special rules for non optional dependencies
if [[ -e dependencies-initial-check-list ]]; then
    grep -q qt tempfile15 && echo hicolor-icon-theme >> tempfile15
    grep -q gtk tempfile15 && echo -e "hicolor-icon-theme\ndesktop-file-utils" >> tempfile15
    grep -q ^Python-Version: control && echo python`grep ^Python-Version: control | gawk '{print $2}' | sed s'/\.//g'` >> tempfile15
	# Fourth method of finding packages names exclusively for non-optional dependencies (accurate)
	for i in $(readelf -d $(find ./ -executable -type f) 2> /dev/null | grep NEEDED | gawk '{print $5}' | sort -u | sed s'/\[\|\]//g'); do
		pkgfile -q "$i" | head -1 >> tempfile15
	done
	# Removing packages names that are part of base group (if any exist)
	touch tempfile15-1
	sort -u tempfile15 | grep -v '^$' | while read line; do
		if [[ $(grep -q "^$(echo "$line" | gawk '{print $1}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//')$" /var/cache/debtap/base-packages; echo $?) != 0 ]]; then
			echo "$line" >> tempfile15-1
		fi
	done
	mv tempfile15-1 tempfile15
fi

# Sorting packages names and versions
sort -u tempfile15 > tempfile16

# Sorting only packages names
gawk '{print $1}' tempfile16 | sort -u > tempfile17

# Removing packages names that are the same with the name of the package to be converted from translated packages list (if any exist)
touch tempfile18
for i in `cat tempfile17`; do
    if [[ $(echo " $(echo $(grep ^pkgname .PKGINFO | gawk '{print $3}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//'){-svn,-git,-cvs,-bzr,-darcs,-hg,}) " | grep -q " $(echo $i | sed s'/^lib32-\|-multilib$//') "; echo $?) != 0 ]]; then
		echo "$i" >> tempfile18
		grep "^$i$\|^$i " tempfile16 >> $i-tempfile19
    fi
done

touch tempfile22
if [[ $wipeout != set ]] && [[ $(ls *-tempfile19 &> /dev/null; echo $?) == 0 ]]; then
	# Isolating versions from packages
	for i in `ls | grep tempfile19`; do
		if [[ $(grep -q "=\|>\|<" $i; echo $?) != 0 ]]; then
			cat $i >> `echo $i | sed s'/tempfile19/tempfile21/'`
		else
			cat $i | while read line; do
				echo $line | gawk '{print $3}' | sed -e s'/\.[a-z]/ /g' -e s'/[a-z]/ /g' | gawk '{print $1}' >> `echo $i | sed s'/tempfile19/tempfile20/'`
			done
		fi
	done

	# Sorting versions for each package
	for i in `ls | grep tempfile20`; do
		j=`echo $i | sed s'/tempfile20/tempfile19/'`
		k=`echo $i | sed s'/tempfile20/tempfile21/'`
		for l in `sort -uV $i | grep -v "^$"`; do
			grep -q "$l[a-z]\+" $j && grep "$l[a-z]\+" $j | sort -V >> $k
			grep -q "$l$" $j && grep "$l$" $j >> $k
			grep -q "$l\.[a-z]\+" $j && grep "$l\.[a-z]\+" $j | sort -V >> $k
		done
	done

	# Choosing the appropriate version for each package
	for i in `ls | grep tempfile21`; do
		if [[ $(grep -q "=\|>\|<" $i; echo $?) != 0 ]]; then
			cat $i >> tempfile22
		elif [[ $(grep -q "=" $i; echo $?) == 0 ]] && [[ $(grep -q ">\|<" $i; echo $?) != 0 ]]; then
			grep "=" $i | tail -1 | sed s'/ //g' >> tempfile22
		elif [[ $(grep -q ">" $i; echo $?) == 0 ]] && [[ $(grep -q "<" $i; echo $?) != 0 ]]; then
			grep ">" $i | tail -1 | sed s'/ //g' >> tempfile22
		elif [[ $(grep -q "<" $i; echo $?) == 0 ]] && [[ $(grep -q ">" $i; echo $?) != 0 ]]; then
			grep "<" $i | head -1 | sed s'/ //g' >> tempfile22
		elif [[ $(grep -q ">" $i; echo $?) == 0 ]] && [[ $(grep -q "<" $i; echo $?) == 0 ]]; then
			grep ">" $i | tail -1 | sed s'/ //g' >> tempfile22
			grep "<" $i | head -1 | sed s'/ //g' >> tempfile22
		fi
	done
fi
}

# Generating replacements fields
if [[ $(grep -q ^Replaces: control; echo $?) == 0 ]]; then
    grep -i ^Replaces: control | sed -e s'/^Replaces://g' -e s'/^ //g' -e s'/ (/(/g' -e s'/= /=/g' -e s'/>> />/g' -e s'/<< /</g' -e s'/,\||/ /g' -e s'/  / /g' | while read line; do
		for word in $line; do
			echo $word >> tempfile01
		done
    done
    sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
    grep -v '^xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > replacements-initial-check-list
    packages-names-translator
	if [[ $wipeout != set ]]; then
		for i in `sort -u tempfile22`; do echo "replaces = $i" >> .PKGINFO; done
	else
		for i in `sort -u tempfile18`; do echo "replaces = $i" >> .PKGINFO; done
	fi
	rm -rf *tempfile* replacements-initial-check-list final-check-list
fi

# Generating conflicts fields
if [[ $(grep -q ^Conflicts: control; echo $?) == 0 ]]; then
    grep -i ^Conflicts: control | sed -e s'/^Conflicts://g' -e s'/^ //g' -e s'/ (/(/g' -e s'/= /=/g' -e s'/>> />/g' -e s'/<< /</g' -e s'/,\||/ /g' -e s'/  / /g' | while read line; do
		for word in $line; do
			echo $word >> tempfile01
		done
    done
    sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
    grep -v 'xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > conflicts-initial-check-list
    packages-names-translator
	if [[ $wipeout != set ]]; then
		for i in `sort -u tempfile22`; do echo "conflict = $i" >> .PKGINFO; done
	else
		for i in `sort -u tempfile18`; do echo "conflict = $i" >> .PKGINFO; done
	fi
	rm -rf *tempfile* conflicts-initial-check-list final-check-list
fi

# Generating provisions fields
if [[ $(grep -q ^Provides: control; echo $?) == 0 ]]; then
    grep -i ^Provides: control | sed -e s'/^Provides://g' -e s'/^ //g' -e s'/ (/(/g' -e s'/= /=/g' -e s'/>> />/g' -e s'/<< /</g' -e s'/,\||/ /g' -e s'/  / /g' | while read line; do
		for word in $line; do
			echo $word >> tempfile01
		done
    done
    sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
    grep -v 'xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > provisions-initial-check-list
    packages-names-translator
	if [[ $wipeout != set ]] && [[ $pkgbuild != set ]] && [[ $Pkgbuild != set ]]; then
		for i in `sort -u tempfile22`; do echo "provides = $i" >> .PKGINFO; done
	else
		for i in `sort -u tempfile18`; do echo "provides = $i" >> .PKGINFO; done
	fi
	rm -rf *tempfile* provisions-initial-check-list final-check-list
fi

# Generating backups fields
if [[ -e conffiles ]]; then
    sed s'/^\///g' conffiles > tempfile
    if [[ $pseudo != set ]]; then
		if [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
			sed -i -e s'/^bin\//usr\/bin\//g' -e s'/^sbin\//usr\/bin\//g' -e s'/^usr\/sbin\//usr\/bin\//g' -e s'/^usr\/games\//usr\/bin\//g' -e s'/^lib\//usr\/lib\//g' -e s'/^lib32\//usr\/lib\//g' -e s'/^usr\/lib32\//usr\/lib\//g' -e s'/^usr\/local\/sbin\//usr\/bin\//g' -e s'/^usr\/local\/games\//usr\/bin\//g' -e s'/^usr\/local\/lib32\//usr\/lib\//g' -e s'/^usr\/local\//usr\//g' tempfile
		else
			sed -i -e s'/^bin\//usr\/bin\//g' -e s'/^sbin\//usr\/bin\//g' -e s'/^usr\/sbin\//usr\/bin\//g' -e s'/^usr\/games\//usr\/bin\//g' -e s'/^lib\//usr\/lib\//g' -e s'/^lib32\//usr\/lib32\//g' -e s'/^lib64\//usr\/lib\//g' -e s'/^usr\/lib64\//usr\/lib\//g' -e s'/^usr\/local\/sbin\//usr\/bin\//g' -e s'/^usr\/local\/games\//usr\/bin\//g' -e s'/^usr\/local\/lib64\//usr\/lib\//g' -e s'/^usr\/local\//usr\//g' tempfile
		fi
	else
		sed -i -e s'/^bin\//usr\/bin\//g' -e s'/^sbin\//usr\/bin\//g' -e s'/^usr\/sbin\//usr\/bin\//g' -e s'/^usr\/games\//usr\/bin\//g' -e s'/^lib\//usr\/lib32\//g' -e s'/^lib32\//usr\/lib32\//g' -e s'/^usr\/lib\//usr\/lib32\//g' -e s'/^usr\/local\/sbin\//usr\/bin\//g' -e s'/^usr\/local\/games\//usr\/bin\//g' -e s'/^usr\/local\/lib\//usr\/lib32\//g' -e s'/^usr\/local\//usr\//g' tempfile
	fi
	for i in `sort -u tempfile`; do echo "backup = $i" >> .PKGINFO; done
	rm -rf tempfile
fi

# Generating non optional dependencies fields
if [[ $(grep -q '^Depends:\|^Pre-Depends:' control; echo $?) == 0 ]]; then
    grep '^Depends:\|^Pre-Depends:' control | sed -e s'/^Pre-Depends://g' -e s'/^Depends://g' -e s'/^ //g' -e s'/ (/(/g' -e s'/= /=/g' -e s'/>> />/g' -e s'/<< /</g' -e s'/,\||/ /g' -e s'/  / /g' | while read line; do
		for word in $line; do
			echo $word >> tempfile01
		done
    done
    sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
    grep -v 'xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > dependencies-initial-check-list
    packages-names-translator
	if [[ $wipeout != set ]]; then
		for i in `sort -u tempfile22`; do echo "depend = $i" >> .PKGINFO; done
	else
		for i in `sort -u tempfile18`; do echo "depend = $i" >> .PKGINFO; done
	fi
	rm -rf *tempfile* dependencies-initial-check-list final-check-list
fi

# Generating optional dependencies fields
if [[ $(grep -q '^Recommends:\|^Suggests:' control; echo $?) == 0 ]]; then
    grep '^Recommends:\|^Suggests:' control | sed -e s'/^Recommends:\|^Suggests://g' -e s'/^ //g' -e s'/ (/(/g' -e s'/= /=/g' -e s'/>> />/g' -e s'/<< /</g' -e s'/,\||/ /g' -e s'/  / /g' | while read line; do
		for word in $line; do
			echo $word >> tempfile01
		done
    done
    sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
    grep -v 'xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > optional-dependencies-initial-check-list
    packages-names-translator
	if [[ $wipeout != set ]]; then
		for i in `sort -u tempfile22`; do
			j=$(echo $i | sed s'/=\|>\|</ /' | gawk '{print $1}')
			if [[ $(grep -q "^depend = $j$\|^depend = $j[=|>|<]" .PKGINFO; echo $?) != 0 ]]; then
				echo "optdepend = $i" >> .PKGINFO
			fi
		done
	else
		for i in `sort -u tempfile18`; do
			if [[ $(grep -q "^depend = $i$\|^depend = $i[=|>|<]" .PKGINFO; echo $?) != 0 ]]; then
				echo "optdepend = $i" >> .PKGINFO
			fi
		done
	fi
	rm -rf *tempfile* optional-dependencies-initial-check-list final-check-list
fi

# Moving report files to /tmp/debtap (if any exist)
rm -rf /tmp/debtap 2> /dev/null
mkdir /tmp/debtap 2> /dev/null
if [[ $(echo $?) != 0 ]]; then
	echo -e "${red}Error: Cannot create /tmp/debtap, permission denied${NC}"
fi
mv *untranslated* /tmp/debtap 2> /dev/null
mv *missing-files /tmp/debtap 2> /dev/null

# Report of (warning messages for) untranslated packages names and packages with missing files (if any exist)
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]]; then
    echo -e "\n${lightred}Warning: These dependencies (depend =   fields) could not be translated into Arch Linux packages names:${NC}"
    echo `cat /tmp/debtap/dependencies-untranslated-names-only` | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/dependencies-missing-files ]]; then
    if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]]; then
	echo -e "${lightred}Warning: These packages names could not be included as dependencies, because debtap has translated them into the same name with the package for conversion. This happens sometimes when you convert packages that already exist in your repositories (which is a bad idea in general). The following packages contain files that are already included in the package from your repositories (without these files your converted package may be dysfunctional):${NC}"
    else
	echo -e "\n${lightred}Warning: These packages names could not be included as dependencies, because debtap has translated them into the same name with the package for conversion. This happens sometimes when you convert packages that already exist in your repositories (which is a bad idea in general). The following packages contain files that are already included in the package from your repositories (without these files your converted package may be dysfunctional):${NC}"
    fi
    echo `cat /tmp/debtap/dependencies-missing-files` | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]]; then
    if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]]; then
	echo -e "${lightred}Warning: These optional dependencies (optdepend =   fields) could not be translated into Arch Linux packages names:${NC}"
    else
	echo -e "\n${lightred}Warning: These optional dependencies (optdepend =   fields) could not be translated into Arch Linux packages names:${NC}"
    fi
    echo `cat /tmp/debtap/optional-dependencies-untranslated-names-only-1` | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/replacements-untranslated-names-only ]]; then
    if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]]; then
	echo -e "${lightred}Warning: These replacements (replaces =   fields) could not be translated into Arch Linux packages names:${NC}"
    else
	echo -e "\n${lightred}Warning: These replacements (replaces =   fields) could not be translated into Arch Linux packages names:${NC}"
    fi
    echo `cat /tmp/debtap/replacements-untranslated-names-only` | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/conflicts-untranslated-names-only ]]; then
    if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]] || [[ -e /tmp/debtap/replacements-untranslated-names-only ]]; then
	echo -e "${lightred}Warning: These conflicts (conflict =   fields) could not be translated into Arch Linux packages names:${NC}"
    else
	echo -e "\n${lightred}Warning: These conflicts (conflict =   fields) could not be translated into Arch Linux packages names:${NC}"
    fi
    echo `cat /tmp/debtap/conflicts-untranslated-names-only` | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/provisions-untranslated-names-only ]]; then
    if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]] || [[ -e /tmp/debtap/replacements-untranslated-names-only ]] || [[ -e /tmp/debtap/conflicts-untranslated-names-only ]]; then
	echo -e "${lightred}Warning: These provisions (provides =   fields) could not be translated into Arch Linux packages names:${NC}"
    else
	echo -e "\n${lightred}Warning: These provisions (provides =   fields) could not be translated into Arch Linux packages names:${NC}"
    fi
    echo `cat /tmp/debtap/provisions-untranslated-names-only` | sed s'/ /, /g'
fi

# Generating .INSTALL file (if necessary)
echo -e "\n${lightgreen}==>${NC} ${bold}Checking and generating .INSTALL file (if necessary)...${normal}"

SAVEIFS=$IFS
IFS=$'\n'
echo "pre_install() {" > tempfile1
if [[ -e preinst ]]; then
	sed -i -e '/how this script works/,/debian-policy/d' -e '/how this script works/,/version>/d' -e '/dh_installdeb/,/DEBHELPER/d' preinst
	if [[ $(grep -c "case in \$1\|case in \${1}\|case in \"\$1\"\|case in \"\${1}\"\|case \$1 in\|case \${1} in\|case \"\$1\" in\|case \"\${1}\" in" preinst) == $(grep -c "case " preinst) ]]; then
		sed -i -e '/case in \$1/,/upgrade/{/upgrade/!d}' -e '/case in \${1}/,/upgrade/{/upgrade/!d}' -e '/case in "\$1"/,/upgrade/{/upgrade/!d}' -e '/case in "\${1}"/,/upgrade/{/upgrade/!d}' -e '/case \$1 in/,/upgrade/{/upgrade/!d}' -e '/case \${1} in/,/upgrade/{/upgrade/!d}' -e '/case "\$1" in/,/upgrade/{/upgrade/!d}' -e '/case "\${1}" in/,/upgrade/{/upgrade/!d}' -e '/case in \$1/,/install/{/install/!d}' -e '/case in {1}/,/install/{/install/!d}' -e '/case in "\$1"/,/install/{/install/!d}' -e '/case in "{1}"/,/install/{/install/!d}' -e '/case \$1 in/,/install/{/install/!d}' -e '/case {1} in/,/install/{/install/!d}' -e '/case "\$1" in/,/install/{/install/!d}' -e '/case "{1}" in/,/install/{/install/!d}' -e '/case in \$1/,/update-alternatives/{/update-alternatives/!d}' -e '/case in {1}/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "\$1"/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "{1}"/,/update-alternatives/{/update-alternatives/!d}' -e '/case \$1 in/,/update-alternatives/{/update-alternatives/!d}' -e '/case {1} in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "\$1" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "{1}" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case in \$1/,/db_/{/db_/!d}' -e '/case in {1}/,/db_/{/db_/!d}' -e '/case in "\$1"/,/db_/{/db_/!d}' -e '/case in "{1}"/,/db_/{/db_/!d}' -e '/case \$1 in/,/db_/{/db_/!d}' -e '/case {1} in/,/db_/{/db_/!d}' -e '/case "\$1" in/,/db_/{/db_/!d}' -e '/case "{1}" in/,/db_/{/db_/!d}' -e '/;;/,/esac/{/;;/!d}' preinst
		sed -i -e '/[[:blank:]]\{0,\}update-alternatives.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/update-alternatives/d' -e '/[[:blank:]]\{0,\}lintian.*/,/}/d' -e '/[[:blank:]]\{0,\}if.*update-app-install.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*update-software-center.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*RET.*/,/fi/d' -e '/.*\*)[[:blank:]]\{0,\}/,/esac/d' preinst
		sed -i -e '/.*upgrade.*)[[:blank:]]\{0,\}$/d' -e '/.*install.*)[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/d' preinst
		sed -i -e s'/.*\*)[[:blank:]]{0,\}\(.*\)/\1/g' -e s'/.*upgrade.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/.*install.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/\1/g' preinst
	fi
	grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|abort\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' preinst | while read -r line; do
	printf '\t%s\n' "$line" >> tempfile1
	done
fi
echo "}" >> tempfile1
if [[ $(echo $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 15))) != $(echo $(($(wc -c < tempfile1) - $(wc -l < tempfile1)))) ]]; then
	cat tempfile1 >> tempfile2
fi

echo -e "\npost_install() {" > tempfile1
if [[ $(grep '^depend' .PKGINFO | grep -q qt; echo $?) == 0 ]]; then
	echo -e '\txdg-icon-resource forceupdate --theme hicolor &> /dev/null' >> tempfile1
elif [[ $(grep '^depend' .PKGINFO | grep -q gtk; echo $?) == 0 ]]; then
	echo -e '\tgtk-update-icon-cache -q -t -f usr/share/icons/hicolor' >> tempfile1
fi
if [[ -e postinst ]]; then
	sed -i -e '/how this script works/,/debian-policy/d' -e '/how this script works/,/version>/d' -e '/dh_installdeb/,/DEBHELPER/d' postinst
	if [[ $(grep -c "case in \$1\|case in \${1}\|case in \"\$1\"\|case in \"\${1}\"\|case \$1 in\|case \${1} in\|case \"\$1\" in\|case \"\${1}\" in" postinst) == $(grep -c "case " postinst) ]]; then
		sed -i -e '/case in \$1/,/configure/{/configure/!d}' -e '/case in \${1}/,/configure/{/,configure/!d}' -e '/case in "\$1"/,/configure/{/configure/!d}' -e '/case in "\${1}"/,/configure/{/,configure/!d}' -e '/case \$1 in/,/configure/{/configure/!d}' -e '/case \${1} in/,/configure/{/,configure/!d}' -e '/case in "\$1"/,/configure/{/configure/!d}' -e '/case "\${1}" in/,/configure/{/,configure/!d}' -e '/case in \$1/,/update-alternatives/{/update-alternatives/!d}' -e '/case in {1}/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "\$1"/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "{1}"/,/update-alternatives/{/update-alternatives/!d}' -e '/case \$1 in/,/update-alternatives/{/update-alternatives/!d}' -e '/case {1} in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "\$1" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "{1}" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case in \$1/,/db_/{/db_/!d}' -e '/case in {1}/,/db_/{/db_/!d}' -e '/case in "\$1"/,/db_/{/db_/!d}' -e '/case in "{1}"/,/db_/{/db_/!d}' -e '/case \$1 in/,/db_/{/db_/!d}' -e '/case {1} in/,/db_/{/db_/!d}' -e '/case "\$1" in/,/db_/{/db_/!d}' -e '/case "{1}" in/,/db_/{/db_/!d}' -e '/;;/,/esac/{/;;/!d}' postinst
		sed -i -e '/[[:blank:]]\{0,\}update-alternatives.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/update-alternatives/d' -e '/[[:blank:]]\{0,\}lintian.*/,/}/d' -e '/[[:blank:]]\{0,\}if.*update-app-install.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*update-software-center.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*RET.*/,/fi/d' -e '/.*\*)[[:blank:]]\{0,\}/,/esac/d' postinst
		sed -i -e '/.*configure.*)[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/d' postinst
		sed -i -e s'/.*\*)[[:blank:]]{0,\}\(.*\)/\1/g' -e s'/.*configure.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/\1/g' postinst
	fi
	grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|abort\|update-alternative\|--slave\|db_\|remove_source\|update_manager\|lintian' postinst | while read -r line; do
		printf '\t%s\n' "$line" >> tempfile1
	done
fi
if [[ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) == 0 ]]; then
	echo -e '\tupdate-desktop-database -q' >> tempfile1
fi
echo "}" >> tempfile1
if [[ $(echo $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 16))) != $(echo $(($(wc -c < tempfile1) - $(wc -l < tempfile1)))) ]]; then
	cat tempfile1 >> tempfile2
fi

if [[ $(grep -q '^pre_install() {$' tempfile2 2> /dev/null; echo $?) == 0 ]]; then
	echo -e "\npre_upgrade() {" >> tempfile2
	echo -e "\tpre_install" >> tempfile2
	echo "}" >> tempfile2
fi

if [[ $(grep -q '^post_install() {$' tempfile2 2> /dev/null; echo $?) == 0 ]]; then
	echo -e "\npost_upgrade() {" >> tempfile2
	echo -e "\tpost_install" >> tempfile2
	echo "}" >> tempfile2
fi

echo -e "\npre_remove() {" > tempfile1
if [[ -e prerm ]]; then
	sed -i -e '/how this script works/,/debian-policy/d' -e '/how this script works/,/version>/d' -e '/dh_installdeb/,/DEBHELPER/d' prerm
	if [[ $(grep -c "case in \$1\|case in \${1}\|case in \"\$1\"\|case in \"\${1}\"\|case \$1 in\|case \${1} in\|case \"\$1\" in\|case \"\${1}\" in" prerm) == $(grep -c "case " prerm) ]]; then
		sed -i -e '/case in \$1/,/remove/{/remove/!d}' -e '/case in {1}/,/remove/{/remove/!d}' -e '/case in "\$1"/,/remove/{/remove/!d}' -e '/case in "{1}"/,/remove/{/remove/!d}' -e '/case \$1 in/,/remove/{/remove/!d}' -e '/case {1} in/,/remove/{/remove/!d}' -e '/case "\$1" in/,/remove/{/remove/!d}' -e '/case "{1}" in/,/remove/{/remove/!d}' -e '/case in \$1/,/upgrade/{/upgrade/!d}' -e '/case in \${1}/,/upgrade/{/upgrade/!d}' -e '/case in "\$1"/,/upgrade/{/upgrade/!d}' -e '/case in "\${1}"/,/upgrade/{/upgrade/!d}' -e '/case \$1 in/,/upgrade/{/upgrade/!d}' -e '/case \${1} in/,/upgrade/{/upgrade/!d}' -e '/case "\$1" in/,/upgrade/{/upgrade/!d}' -e '/case "\${1}" in/,/upgrade/{/upgrade/!d}' -e '/case in \$1/,/update-alternatives/{/update-alternatives/!d}' -e '/case in {1}/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "\$1"/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "{1}"/,/update-alternatives/{/update-alternatives/!d}' -e '/case \$1 in/,/update-alternatives/{/update-alternatives/!d}' -e '/case {1} in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "\$1" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "{1}" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case in \$1/,/db_/{/db_/!d}' -e '/case in {1}/,/db_/{/db_/!d}' -e '/case in "\$1"/,/db_/{/db_/!d}' -e '/case in "{1}"/,/db_/{/db_/!d}' -e '/case \$1 in/,/db_/{/db_/!d}' -e '/case {1} in/,/db_/{/db_/!d}' -e '/case "\$1" in/,/db_/{/db_/!d}' -e '/case "{1}" in/,/db_/{/db_/!d}' -e '/;;/,/esac/{/;;/!d}' prerm
		sed -i -e '/[[:blank:]]\{0,\}update-alternatives.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/update-alternatives/d' -e '/[[:blank:]]\{0,\}lintian.*/,/}/d' -e '/[[:blank:]]\{0,\}if.*update-app-install.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*update-software-center.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*RET.*/,/fi/d' -e '/.*\*)[[:blank:]]\{0,\}/,/esac/d' prerm
		sed -i -e '/.*remove.*)[[:blank:]]\{0,\}$/d' -e '/.*upgrade.*)[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/d' prerm
		sed -i -e s'/.*\*)[[:blank:]]{0,\}\(.*\)/\1/g' -e s'/.*remove.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/.*upgrade.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/\1/g' prerm
	fi
	grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|abort\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' prerm | while read -r line; do
		printf '\t%s\n' "$line" >> tempfile1
	done
fi
echo "}" >> tempfile1
if [[ $(echo $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 14))) != $(echo $(($(wc -c < tempfile1) - $(wc -l < tempfile1)))) ]]; then
	cat tempfile1 >> tempfile2
fi

echo -e "\npost_remove() {" > tempfile1
if [[ $(grep '^depend' .PKGINFO | grep -q qt; echo $?) == 0 ]]; then
	echo -e '\txdg-icon-resource forceupdate --theme hicolor &> /dev/null' >> tempfile1
elif [[ $(grep '^depend' .PKGINFO | grep -q gtk; echo $?) == 0 ]]; then
	echo -e '\tgtk-update-icon-cache -q -t -f usr/share/icons/hicolor' >> tempfile1
fi
if [[ -e postrm ]]; then
	sed -i -e '/how this script works/,/debian-policy/d' -e '/how this script works/,/version>/d' -e '/dh_installdeb/,/DEBHELPER/d' postrm
	if [[ $(grep -c "case in \$1\|case in \${1}\|case in \"\$1\"\|case in \"\${1}\"\|case \$1 in\|case \${1} in\|case \"\$1\" in\|case \"\${1}\" in" postrm) == $(grep -c "case " postrm) ]]; then
		sed -i -e '/case in \$1/,/remove/{/remove/!d}' -e '/case in {1}/,/remove/{/remove/!d}' -e '/case in "\$1"/,/remove/{/remove/!d}' -e '/case in "{1}"/,/remove/{/remove/!d}' -e '/case \$1 in/,/remove/{/remove/!d}' -e '/case {1} in/,/remove/{/remove/!d}' -e '/case "\$1" in/,/remove/{/remove/!d}' -e '/case "{1}" in/,/remove/{/remove/!d}' -e '/case in \$1/,/purge/{/purge/!d}' -e '/case in {1}/,/purge/{/purge/!d}' -e '/case in "\$1"/,/purge/{/purge/!d}' -e '/case in "{1}"/,/purge/{/purge/!d}' -e '/case \$1 in/,/purge/{/purge/!d}' -e '/case {1} in/,/purge/{/purge/!d}' -e '/case "\$1" in/,/purge/{/purge/!d}' -e '/case "{1}" in/,/purge/{/purge/!d}' -e '/case in \$1/,/upgrade/{/upgrade/!d}' -e '/case in \${1}/,/upgrade/{/upgrade/!d}' -e '/case in "\$1"/,/upgrade/{/upgrade/!d}' -e '/case in "\${1}"/,/upgrade/{/upgrade/!d}' -e '/case \$1 in/,/upgrade/{/upgrade/!d}' -e '/case \${1} in/,/upgrade/{/upgrade/!d}' -e '/case "\$1" in/,/upgrade/{/upgrade/!d}' -e '/case "\${1}" in/,/upgrade/{/upgrade/!d}' -e '/case in \$1/,/update-alternatives/{/update-alternatives/!d}' -e '/case in {1}/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "\$1"/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "{1}"/,/update-alternatives/{/update-alternatives/!d}' -e '/case \$1 in/,/update-alternatives/{/update-alternatives/!d}' -e '/case {1} in/,/update-alternatives/{/upda..te-alternatives/!d}' -e '/case "\$1" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "{1}" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case in \$1/,/db_/{/db_/!d}' -e '/case in {1}/,/db_/{/db_/!d}' -e '/case in "\$1"/,/db_/{/db_/!d}' -e '/case in "{1}"/,/db_/{/db_/!d}' -e '/case \$1 in/,/db_/{/db_/!d}' -e '/case {1} in/,/db_/{/db_/!d}' -e '/case "\$1" in/,/db_/{/db_/!d}' -e '/case "{1}" in/,/db_/{/db_/!d}' -e '/;;/,/esac/{/;;/!d}' postrm
		sed -i -e '/[[:blank:]]\{0,\}update-alternatives.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/update-alternatives/d' -e '/[[:blank:]]\{0,\}lintian.*/,/}/d' -e '/[[:blank:]]\{0,\}if.*update-app-install.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*update-software-center.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*RET.*/,/fi/d' -e '/.*\*)[[:blank:]]\{0,\}/,/esac/d' postrm
		sed -i -e '/.*remove.*)[[:blank:]]\{0,\}$/d' -e '/.*purge.*)[[:blank:]]\{0,\}$/d' -e '/.*upgrade.*)[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/d' postrm
		sed -i -e s'/.*\*)[[:blank:]]{0,\}\(.*\)/\1,/g' -e s'/.*remove.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/.*purge.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/.*upgrade.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/\1/g' postrm
	fi
	grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|abort\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' postrm | while read -r line; do
		printf '\t%s\n' "$line" >> tempfile1
	done
fi
if [[ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) == 0 ]]; then
	echo -e '\tupdate-desktop-database -q' >> tempfile1
fi
echo "}" >> tempfile1
if [[ $(echo $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 15))) != $(echo $(($(wc -c < tempfile1) - $(wc -l < tempfile1)))) ]]; then
	cat tempfile1 >> tempfile2
fi
IFS=$SAVEIFS

if [[ -e tempfile2 ]]; then
	if [[ $(sed -n "1{p;q;}" tempfile2) == "" ]]; then
		sed -i '1d' tempfile2
	fi

	sed -i s'/^[[:blank:]]\{1,\}$//g' tempfile2
    
	if [[ $pseudo != set ]]; then
		if [[ $(grep -i ^Architecture: control \| grep -q i386; echo $?) == 0 ]]; then
			sed -i -e s'/ \/bin\// \/usr\/bin\//g' -e s'/ \/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/games\// \/usr\/bin\//g' -e s'/ \/lib\// \/usr\/lib\//g' -e s'/ \/lib32\// \/usr\/lib\//g' -e s'/ \/usr\/lib32\// \/usr\/lib\//g' -e s'/ \/usr\/local\/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/local\/games\// \/usr\/bin\//g' -e s'/ \/usr\/local\/lib32\// \/usr\/lib\//g' -e s'/ \/usr\/local\// \/usr\//g' tempfile2
			sed -i -e s'/=\/bin\//=\/usr\/bin\//g' -e s'/=\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/games\//=\/usr\/bin\//g' -e s'/=\/lib\//=\/usr\/lib\//g' -e s'/=\/lib32\//=\/usr\/lib\//g' -e s'/=\/usr\/lib32\//=\/usr\/lib\//g' -e s'/=\/usr\/local\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/local\/games\//=\/usr\/bin\//g' -e s'/=\/usr\/local\/lib32\//=\/usr\/lib\//g' -e s'/=\/usr\/local\//=\/usr\//g' tempfile2
			sed -i -e s'/>\/bin\//>\/usr\/bin\//g' -e s'/>\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/games\//>\/usr\/bin\//g' -e s'/>\/lib\//>\/usr\/lib\//g' -e s'/>\/lib32\//>\/usr\/lib\//g' -e s'/>\/usr\/lib32\//>\/usr\/lib\//g' -e s'/>\/usr\/local\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/local\/games\//>\/usr\/bin\//g' -e s'/>\/usr\/local\/lib32\//>\/usr\/lib\//g' -e s'/>\/usr\/local\//>\/usr\//g' tempfile2
			sed -i -e s'/<\/bin\//<\/usr\/bin\//g' -e s'/<\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/games\//<\/usr\/bin\//g' -e s'/<\/lib\//<\/usr\/lib\//g' -e s'/<\/lib32\//<\/usr\/lib\//g' -e s'/<\/usr\/lib32\//<\/usr\/lib\//g' -e s'/<\/usr\/local\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/local\/games\//<\/usr\/bin\//g' -e s'/<\/usr\/local\/lib32\//<\/usr\/lib\//g' -e s'/<\/usr\/local\//<\/usr\//g' tempfile2
			sed -i -e s'/"\/bin\//"\/usr\/bin\//g' -e s'/"\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/games\//"\/usr\/bin\//g' -e s'/"\/lib\//"\/usr\/lib\//g' -e s'/"\/lib32\//"\/usr\/lib\//g' -e s'/"\/usr\/lib32\//"\/usr\/lib\//g' -e s'/"\/usr\/local\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/local\/games\//"\/usr\/bin\//g' -e s'/"\/usr\/local\/lib32\//"\/usr\/lib\//g' -e s'/"\/usr\/local\//"\/usr\//g' tempfile2
			sed -i -e s"/'\/bin\//'\/usr\/bin\//g" -e s"/'\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/games\//'\/usr\/bin\//g" -e s"/'\/lib\//'\/usr\/lib\//g" -e s"/'\/lib32\//'\/usr\/lib\//g" -e s"/'\/usr\/lib32\//'\/usr\/lib\//g" -e s"/'\/usr\/local\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/local\/games\//'\/usr\/bin\//g" -e s"/'\/usr\/local\/lib32\//'\/usr\/lib\//g" -e s"/'\/usr\/local\//'\/usr\//g" tempfile2
		else
			sed -i -e s'/ \/bin\// \/usr\/bin\//g' -e s'/ \/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/games\// \/usr\/bin\//g' -e s'/ \/lib\// \/usr\/lib\//g' -e s'/ \/lib32\// \/usr\/lib32\//g' -e s'/ \/lib64\// \/usr\/lib\//g' -e s'/ \/usr\/lib64\// \/usr\/lib\//g' -e s'/ \/usr\/local\/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/local\/games\// \/usr\/bin\//g' -e s'/ \/usr\/local\/lib64\// \/usr\/lib\//g' -e s'/ \/usr\/local\// \/usr\//g' tempfile2
			sed -i -e s'/=\/bin\//=\/usr\/bin\//g' -e s'/=\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/games\//=\/usr\/bin\//g' -e s'/=\/lib\//=\/usr\/lib\//g' -e s'/=\/lib32\//=\/usr\/lib32\//g' -e s'/=\/lib64\//=\/usr\/lib\//g' -e s'/=\/usr\/lib64\//=\/usr\/lib\//g' -e s'/=\/usr\/local\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/local\/games\//=\/usr\/bin\//g' -e s'/=\/usr\/local\/lib64\//=\/usr\/lib\//g' -e s'/=\/usr\/local\//=\/usr\//g' tempfile2
			sed -i -e s'/>\/bin\//>\/usr\/bin\//g' -e s'/>\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/games\//>\/usr\/bin\//g' -e s'/>\/lib\//>\/usr\/lib\//g' -e s'/>\/lib32\//>\/usr\/lib32\//g' -e s'/>\/lib64\//>\/usr\/lib\//g' -e s'/>\/usr\/lib64\//>\/usr\/lib\//g' -e s'/>\/usr\/local\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/local\/games\//>\/usr\/bin\//g' -e s'/>\/usr\/local\/lib64\//>\/usr\/lib\//g' -e s'/>\/usr\/local\//>\/usr\//g' tempfile2
			sed -i -e s'/<\/bin\//<\/usr\/bin\//g' -e s'/<\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/games\//<\/usr\/bin\//g' -e s'/<\/lib\//<\/usr\/lib\//g' -e s'/<\/lib32\//<\/usr\/lib32\//g' -e s'/<\/lib64\//<\/usr\/lib\//g' -e s'/<\/usr\/lib64\//<\/usr\/lib\//g' -e s'/<\/usr\/local\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/local\/games\//<\/usr\/bin\//g' -e s'/<\/usr\/local\/lib64\//<\/usr\/lib\//g' -e s'/<\/usr\/local\//<\/usr\//g' tempfile2
			sed -i -e s'/"\/bin\//"\/usr\/bin\//g' -e s'/"\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/games\//"\/usr\/bin\//g' -e s'/"\/lib\//"\/usr\/lib\//g' -e s'/"\/lib32\//"\/usr\/lib32\//g' -e s'/"\/lib64\//"\/usr\/lib\//g' -e s'/"\/usr\/lib64\//"\/usr\/lib\//g' -e s'/"\/usr\/local\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/local\/games\//"\/usr\/bin\//g' -e s'/"\/usr\/local\/lib64\//"\/usr\/lib\//g' -e s'/"\/usr\/local\//"\/usr\//g' tempfile2
			sed -i -e s"/'\/bin\//'\/usr\/bin\//g" -e s"/'\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/games\//'\/usr\/bin\//g" -e s"/'\/lib\//'\/usr\/lib\//g" -e s"/'\/lib32\//'\/usr\/lib32\//g" -e s"/'\/lib64\//'\/usr\/lib\//g" -e s"/'\/usr\/lib64\//'\/usr\/lib\//g" -e s"/'\/usr\/local\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/local\/games\//'\/usr\/bin\//g" -e s"/'\/usr\/local\/lib64\//'\/usr\/lib\//g" -e s"/'\/usr\/local\//'\/usr\//g" tempfile2
		fi
	else
		sed -i -e s'/ \/bin\// \/usr\/bin\//g' -e s'/ \/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/games\// \/usr\/bin\//g' -e s'/ \/lib\// \/usr\/lib32\//g' -e s'/ \/lib32\// \/usr\/lib32\//g' -e s'/ \/usr\/lib\// \/usr\/lib32\//g' -e s'/ \/usr\/local\/sbin\// \/usr\/bin\//g' -e s'/ \/usr\/local\/games\// \/usr\/bin\//g' -e s'/ \/usr\/local\/lib\// \/usr\/lib32\//g' -e s'/ \/usr\/local\// \/usr\//g' tempfile2
		sed -i -e s'/=\/bin\//=\/usr\/bin\//g' -e s'/=\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/games\//=\/usr\/bin\//g' -e s'/=\/lib\//=\/usr\/lib32\//g' -e s'/=\/lib32\//=\/usr\/lib32\//g' -e s'/=\/usr\/lib\//=\/usr\/lib32\//g' -e s'/=\/usr\/local\/sbin\//=\/usr\/bin\//g' -e s'/=\/usr\/local\/games\//=\/usr\/bin\//g' -e s'/=\/usr\/local\/lib\//=\/usr\/lib32\//g' -e s'/=\/usr\/local\//=\/usr\//g' tempfile2
		sed -i -e s'/>\/bin\//>\/usr\/bin\//g' -e s'/>\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/games\//>\/usr\/bin\//g' -e s'/>\/lib\//>\/usr\/lib32\//g' -e s'/>\/lib32\//>\/usr\/lib32\//g' -e s'/>\/usr\/lib\//>\/usr\/lib32\//g' -e s'/>\/usr\/local\/sbin\//>\/usr\/bin\//g' -e s'/>\/usr\/local\/games\//>\/usr\/bin\//g' -e s'/>\/usr\/local\/lib\//>\/usr\/lib32\//g' -e s'/>\/usr\/local\//>\/usr\//g' tempfile2
		sed -i -e s'/<\/bin\//<\/usr\/bin\//g' -e s'/<\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/games\//<\/usr\/bin\//g' -e s'/<\/lib\//<\/usr\/lib32\//g' -e s'/<\/lib32\//<\/usr\/lib32\//g' -e s'/<\/usr\/lib\//<\/usr\/lib32\//g' -e s'/<\/usr\/local\/sbin\//<\/usr\/bin\//g' -e s'/<\/usr\/local\/games\//<\/usr\/bin\//g' -e s'/<\/usr\/local\/lib\//<\/usr\/lib32\//g' -e s'/<\/usr\/local\//<\/usr\//g' tempfile2
		sed -i -e s'/"\/bin\//"\/usr\/bin\//g' -e s'/"\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/games\//"\/usr\/bin\//g' -e s'/"\/lib\//"\/usr\/lib32\//g' -e s'/"\/lib32\//"\/usr\/lib32\//g' -e s'/"\/usr\/lib\//"\/usr\/lib32\//g' -e s'/"\/usr\/local\/sbin\//"\/usr\/bin\//g' -e s'/"\/usr\/local\/games\//"\/usr\/bin\//g' -e s'/"\/usr\/local\/lib\//"\/usr\/lib32\//g' -e s'/"\/usr\/local\//"\/usr\//g' tempfile2
		sed -i -e s"/'\/bin\//'\/usr\/bin\//g" -e s"/'\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/games\//'\/usr\/bin\//g" -e s"/'\/lib\//'\/usr\/lib32\//g" -e s"/'\/lib32\//'\/usr\/lib32\//g" -e s"/'\/usr\/lib\//'\/usr\/lib32\//g" -e s"/'\/usr\/local\/sbin\//'\/usr\/bin\//g" -e s"/'\/usr\/local\/games\//'\/usr\/bin\//g" -e s"/'\/usr\/local\/lib\//'\/usr\/lib32\//g" -e s"/'\/usr\/local\//'\/usr\//g" tempfile2
	fi
	
	for i in {upgrade,install,remove,purge,configure}; do
		sed -i -e s"/ \[\[ \"\$1\" = \"$i\" \]\] &&\| && \[\[ \"\$1\" = \"$i\" \]\]//g" -e s"/ \[ \"\$1\" = \"$i\" \] &&\| && \[ \"\$1\" = \"$i\" \]//g" -e s"/ \[\[ \"\${1}\" = \"$i\" \]\] &&\| && \[\[ \"\${1}\" = \"$i\" \]\]//g" -e s"/ \[ \"\${1}\" = \"$i\" \] &&\| && \[ \"\${1}\" = \"$i\" \]//g" -e s"/ \[\[ \"\$1\" = $i \]\] &&\| && \[\[ \"\$1\" = $i \]\]//g" -e s"/ \[ \"\$1\" = $i \] &&\| && \[ \"\$1\" = $i \]//g" -e s"/ \[\[ \"\${1}\" = $i \]\] &&\| && \[\[ \"\${1}\" = $i \]\]//g" -e s"/ \[ \"\${1}\" = $i \] &&\| && \[ \"\${1}\" = $i \]//g" tempfile2
	done

	sed -e s'/-x "`which update-menus 2> \/dev\/null`"\|-x "`which update-menus 2>\/dev\/null`"/-f usr\/bin\/update-mime-database/g' -e s'/update-menus/update-mime-database usr\/share\/mime \&> \/dev\/null/g' -e s'/dpkg --listfiles\|dpkg -L/pacman -Qql/g' -e s'/ dash / bash /g' tempfile2 > .INSTALL
fi

rm -rf tempfile*

# Removing metadata of original .deb package
rm -rf control preinst postinst prerm postrm conffiles

# Prompting user for editing .PKGINFO and .INSTALL files
if [[ $Quiet != set ]]; then
		if [ -e .INSTALL ]; then
		echo -en "\n${lightblue}::${NC} ${bold}If you want to edit .PKGINFO and .INSTALL files (in this order), press (1) For${normal} ${lightred}vi${NC} ${bold}(2) For${normal} ${lightred}nano${NC} ${bold}(3) For${normal} ${lightred}default editor${NC} ${bold}(4) For${normal} ${lightred}a custom editor${NC} ${bold}or any other key to continue: ${normal}"
		read -n 1 number
		if [[ $number == 1 ]]; then
			echo; vi .PKGINFO; vi .INSTALL
		elif [[ $number == 2 ]]; then
			echo; nano .PKGINFO; nano .INSTALL
		elif [[ $number == 3 ]]; then
			echo; $EDITOR .PKGINFO 2> /dev/null; $EDITOR .INSTALL 2> /dev/null || echo -e "${red}Error: No default editor has been set or no such command${NC}"
		elif [[ $number == 4 ]]; then
			echo -en "\n${lightblue}::${NC} ${bold}Enter command for running custom editor: ${normal}"
			read custom_editor
			$custom_editor .PKGINFO 2> /dev/null; $custom_editor .INSTALL 2> /dev/null || echo -e "${red}Error: No command given or no such command${NC}"
		else
			echo
		fi
    else
		echo -en "\n${lightblue}::${NC} ${bold}If you want to edit .PKGINFO file, press (1) For${normal} ${lightred}vi${NC} ${bold}(2) For${normal} ${lightred}nano${NC} ${bold}(3) For${normal} ${lightred}default editor${NC} ${bold}(4) For${normal} ${lightred}a custom editor${NC} ${bold}or any other key to continue: ${normal}"
		read -n 1 number
		if [[ $number == 1 ]]; then
			echo; vi .PKGINFO
		elif [[ $number == 2 ]]; then
			echo; nano .PKGINFO
		elif [[ $number == 3 ]]; then
			echo; $EDITOR .PKGINFO 2> /dev/null || echo -e "${red}Error: No default editor has been set or no such command${NC}"
		elif [[ $number == 4 ]]; then
			echo -en "\n${lightblue}::${NC} ${bold}Enter command for running custom editor: ${normal}"
			read custom_editor
			$custom_editor .PKGINFO 2> /dev/null || echo -e "${red}Error: No command given or no such command${NC}"
		else
			echo
		fi
    fi
fi

# Generating .MTREE file
echo -e "\n${lightgreen}==>${NC} ${bold}Generating .MTREE file...${normal}"

bsdtar -czf .MTREE --format=mtree --options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' * .PKGINFO .INSTALL 2> /dev/null

# Creating final package in a fakeroot environment
if [[ $Pkgbuild != set ]]; then
echo -e "\n${lightgreen}==>${NC} ${bold}Creating final package...${normal}"
fakeroot << EOF
tar --force-local -pcf `grep '^pkgname =' .PKGINFO | gawk '{print $3}'`-`grep '^pkgver =' .PKGINFO | gawk '{print $3}'`-`grep '^arch =' .PKGINFO | gawk '{print $3}'`.pkg.tar --exclude='pkgbuildinstallations*' * .PKGINFO .INSTALL .MTREE 2> /dev/null
zstd -q -T0 --ultra -20 *.tar
EOF
mv *.zst "$(dirname "$package_with_full_path")"
fi

# Announcement of successful creation of package
if [[ $Pkgbuild != set ]]; then
	echo -e "${lightgreen}==>${NC} ${bold}Package successfully created!${normal}"
fi

if [[ $pkgbuild != set ]] && [[ $Pkgbuild != set ]]; then
	# Removing leftover files
	echo -e "${lightgreen}==>${NC} ${bold}Removing leftover files...${normal}"
	cd ..
	rm -rf "$working_directory"
	rm -rf /tmp/debtap
	exit 0
fi

# Generating PKGBUILD file
echo -e "\n${lightgreen}==>${NC} ${bold}Generating PKGBUILD file...${normal}"
echo "# Generated by debtap" > PKGBUILD
if [[ $quiet == set  ]] || [[ $Quiet == set ]]; then
	echo "# Maintainer: " >> PKGBUILD
	echo "# Contributor: " >> PKGBUILD
else
	echo "# Maintainer: $(grep '^packager =' .PKGINFO | gawk '{print $3}')" >> PKGBUILD
	echo "# Contributor: $(grep '^packager =' .PKGINFO | gawk '{print $3}')" >> PKGBUILD
fi
if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]] && [[ $(ls -A usr/bin 2> /dev/null) ]]; then
	echo "$(grep '^pkgname =' .PKGINFO | sed s'/ //g')-bin" >> PKGBUILD
else
	echo "$(grep '^pkgname =' .PKGINFO | sed s'/ //g')" >> PKGBUILD
fi
echo "$(grep '^pkgver =' .PKGINFO | sed -e s'/ //g' -e s'/-/ /g' | gawk '{print $1}')" >> PKGBUILD
echo "pkgrel=$(grep '^pkgver =' .PKGINFO | sed -e s'/ //g' -e s'/-/ /g' | gawk '{print $2}')" >> PKGBUILD
echo "$(grep '^pkgdesc =' .PKGINFO | sed s'/ = /="/')\"" >> PKGBUILD
if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]]; then
	if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]] || [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
		echo "arch=('i686' 'x86_64')" >> PKGBUILD
	elif [[ $(grep -q '^arch = armv7l$' .PKGINFO; echo $?) == 0 ]]; then
		echo "arch=('armv7l')" >> PKGBUILD
	elif [[ $(grep -q '^arch = aarch64$' .PKGINFO; echo $?) == 0 ]]; then
		echo "arch=('aarch64')" >> PKGBUILD
	elif [[ $(grep -q '^arch = any$' .PKGINFO; echo $?) == 0 ]]; then
		echo "arch=('any')" >> PKGBUILD
	fi
else
	echo "arch=('x86_64')" >> PKGBUILD
fi
echo "$(grep '^url =' .PKGINFO | sed s'/ //g' | sed s'/=/="/')\"" >> PKGBUILD
echo "license=('$(echo $(grep '^license =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
echo "groups=('')" >> PKGBUILD
if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]] && [[ $(grep -q '^depend =' .PKGINFO; echo $?) == 0 ]]; then
	if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]] && [[ $(echo $(grep '^depend =' .PKGINFO | gawk '{print $3}')) != $(echo $(grep '^depend =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g')) ]]; then
		if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]] || [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
			echo "depends_i686=('$(echo $(grep '^depend =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g') | sed s"/ /' '/g")')" >> PKGBUILD
			echo "depends_x86_64=('$(echo $(grep '^depend =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
		fi
	else
		echo "depends=('$(echo $(grep '^depend =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
	fi
fi
if [[ $(grep -q '^optdepend =' .PKGINFO; echo $?) == 0 ]]; then
	if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]] && [[ $(echo $(grep '^optdepend =' .PKGINFO | gawk '{print $3}')) != $(echo $(grep '^optdepend =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g')) ]]; then
		if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]] || [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
			for i in $(grep '^optdepend =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g'); do echo "                 '$i'"; done | sed -e "1 s/^                 /optdepends_i686=(/" -e "$ s/'$/')/" >> PKGBUILD
			for i in $(grep '^optdepend =' .PKGINFO | gawk '{print $3}'); do echo "                   '$i'"; done | sed -e "1 s/^                   /optdepends_x86_64=(/" -e "$ s/'$/')/" >> PKGBUILD
		fi
	else
		for i in $(grep '^optdepend =' .PKGINFO | gawk '{print $3}'); do echo "            '$i'"; done | sed -e "1 s/^            /optdepends=(/" -e "$ s/'$/')/" >> PKGBUILD
	fi
fi
if [[ $(grep -q '^provides =' .PKGINFO; echo $?) == 0 ]]; then
	if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]] && [[ $(echo $(grep '^provides =' .PKGINFO | gawk '{print $3}')) != $(echo $(grep '^provides =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g')) ]]; then
		if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]] || [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
			echo "provides_i686=('$(echo $(grep '^provides =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g') | sed s"/ /' '/g")')" >> PKGBUILD
			echo "provides_x86_64=('$(echo $(grep '^provides =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
		fi
	else
		echo "provides=('$(echo $(grep '^provides =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
	fi
fi
if [[ $(grep -q '^conflicts =' .PKGINFO; echo $?) == 0 ]]; then
	if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]] && [[ $(echo $(grep '^conflicts =' .PKGINFO | gawk '{print $3}')) != $(echo $(grep '^conflicts =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g')) ]]; then
		if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]] || [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
			echo "conflicts_i686=('$(echo $(grep '^conflicts =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g') | sed s"/ /' '/g")')" >> PKGBUILD
			echo "conflicts_x86_64=('$(echo $(grep '^conflicts =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
		fi
	else
		echo "conflicts=('$(echo $(grep '^conflicts =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
	fi
fi
if [[ $(grep -q '^replaces =' .PKGINFO; echo $?) == 0 ]]; then
	if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]] && [[ $(echo $(grep '^replaces =' .PKGINFO | gawk '{print $3}')) != $(echo $(grep '^replaces =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g')) ]]; then
		if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]] || [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
			echo "replaces_i686=('$(echo $(grep '^replaces =' .PKGINFO | gawk '{print $3}' | sed s'/^lib32-\|-multilib$//g') | sed s"/ /' '/g")')" >> PKGBUILD
			echo "replaces_x86_64=('$(echo $(grep '^replaces =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
		fi
	else
		echo "replaces=('$(echo $(grep '^replaces =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
	fi
fi
if [[ $(grep -q '^backup =' .PKGINFO; echo $?) == 0 ]]; then
	if [[ $(grep -q '^pkgname = lib32-' .PKGINFO; echo $?) != 0 ]] && [[ $(grep '^pkgname =' .PKGINFO | grep -q -- '-multilib$'; echo $?) != 0 ]] && [[ $(echo $(grep '^backup =' .PKGINFO | gawk '{print $3}')) != $(echo $(grep '^backup =' .PKGINFO | gawk '{print $3}' | sed s'/^usr\/lib32\//usr\/lib\//g')) ]]; then
		if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]] || [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
			echo "backup_i686=('$(echo $(grep '^backup =' .PKGINFO | gawk '{print $3}' | sed s'/^usr\/lib32\//usr\/lib\//g') | sed s"/ /' '/g")')" >> PKGBUILD
			echo "backup_x86_64=('$(echo $(grep '^backup =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
		fi
	else
		echo "backup=('$(echo $(grep '^backup =' .PKGINFO | gawk '{print $3}') | sed s"/ /' '/g")')" >> PKGBUILD
	fi
fi
echo "options=('!strip' '!emptydirs')" >> PKGBUILD
if [[ -e .INSTALL ]]; then
	echo 'install=${pkgname}.install' >> PKGBUILD
fi
if [[ $pseudo != set ]]; then
	if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]] || [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
		echo "source_i686=(\"PUT_FULL_URL_FOR_DOWNLOADING_i386_DEB_PACKAGE_HERE\")" >> PKGBUILD
		echo "source_x86_64=(\"PUT_FULL_URL_FOR_DOWNLOADING_amd64_DEB_PACKAGE_HERE\")" >> PKGBUILD
	else
		echo "source=(\"PUT_FULL_URL_FOR_DOWNLOADING_DEB_PACKAGE_HERE\")" >> PKGBUILD
	fi
else
	echo "source=(\"PUT_FULL_URL_FOR_DOWNLOADING_i386_DEB_PACKAGE_HERE\")" >> PKGBUILD
fi
if [[ $pseudo != set ]]; then
	if [[ $(grep -q '^arch = i686$' .PKGINFO; echo $?) == 0 ]]; then
		echo "sha512sums_i686=('$(sha512sum "$package_with_full_path" | gawk '{print $1}')')" >> PKGBUILD
		echo "sha512sums_x86_64=('PUT_SHA512SUM_OF_amd64_DEB_PACKAGE_HERE')" >> PKGBUILD
	elif [[ $(grep -q '^arch = x86_64$' .PKGINFO; echo $?) == 0 ]]; then
		echo "sha512sums_i686=('PUT_SHA512SUM_OF_i386_DEB_PACKAGE_HERE')" >> PKGBUILD
		echo "sha512sums_x86_64=('$(sha512sum "$package_with_full_path" | gawk '{print $1}')')" >> PKGBUILD
	else
		echo "sha512sums=('$(sha512sum "$package_with_full_path" | gawk '{print $1}')')" >> PKGBUILD
	fi
else
	echo "sha512sums=('$(sha512sum "$package_with_full_path" | gawk '{print $1}')')" >> PKGBUILD
fi
echo -e "\npackage(){\n\n	# Extract package data" >> PKGBUILD
if [[ $data_tar_check == data.tar.gz ]]; then
    echo "	tar xzf data.tar.gz -C \"\${pkgdir}\"" >> PKGBUILD
elif [[ $data_tar_check == data.tar.xz ]]; then
    echo "	tar xf data.tar.xz -C \"\${pkgdir}\"" >> PKGBUILD
elif [[ $data_tar_check == data.tar.bz2 ]]; then
    echo "	tar xf data.tar.bz2 -C \"\${pkgdir}\"" >> PKGBUILD
elif [[ $data_tar_check == data.tar.lzma ]]; then
    echo "	tar xf data.tar.lzma -C \"\${pkgdir}\"" >> PKGBUILD
elif [[ $data_tar_check == data.tar ]]; then
    echo "	tar xf data.tar -C \"\${pkgdir}\"" >> PKGBUILD 
fi
if [[ -e pkgbuildinstallations1 ]] || [[ -e pkgbuildinstallations2 ]] || [[ -e pkgbuildinstallations32 ]] || [[ -e pkgbuildinstallations64 ]]; then
	if [[ $(grep '^install' pkgbuildinstallations1 2> /dev/null | wc -l) != $(echo $(($(cat pkgbuildinstallations1 2> /dev/null | wc -l) + $(cat pkgbuildinstallations2 2> /dev/null | wc -l) + $(cat pkgbuildinstallations32 2> /dev/null | wc -l) + $(cat pkgbuildinstallations64 2> /dev/null | wc -l)))) ]]; then
		echo -e "\n	# Fix directory structure differences\n	cd \"\${pkgdir}\"" >> PKGBUILD
	fi
fi
if [[ -e pkgbuildinstallations1 ]]; then
	echo >> PKGBUILD
	cat pkgbuildinstallations1 | while read line; do
		echo -e "	$line" >> PKGBUILD
	done
fi
if [[ $(grep -q "^arch=('i686' 'x86_64')$" PKGBUILD; echo $?) == 0 ]]; then
	if [[ -e pkgbuildinstallations32 ]] && [[ -e pkgbuildinstallations64 ]]; then
		echo -e "\n	if [[ \${CARCH} == i686 ]]; then" >> PKGBUILD
		cat pkgbuildinstallations32 | while read line; do
			echo "		$line" >> PKGBUILD
		done
		echo "	elif [[ \${CARCH} == x86_64 ]]; then" >> PKGBUILD
		cat pkgbuildinstallations64 | while read line; do
			echo "		$line" >> PKGBUILD
		done
		echo "	fi" >> PKGBUILD
	elif [[ -e pkgbuildinstallations32 ]] && [[ ! -e pkgbuildinstallations64 ]]; then
		echo -e "\n	if [[ \${CARCH} == i686 ]]; then" >> PKGBUILD
		cat pkgbuildinstallations32 | while read line; do
			echo "		$line" >> PKGBUILD
		done
		echo "	fi" >> PKGBUILD
	elif [[ ! -e pkgbuildinstallations32 ]] && [[ -e pkgbuildinstallations64 ]]; then
		echo -e "\n	if [[ \${CARCH} == x86_64 ]]; then" >> PKGBUILD
		cat pkgbuildinstallations64 | while read line; do
			echo "		$line" >> PKGBUILD
		done
		echo "	fi" >> PKGBUILD
	fi
elif [[ $(grep -q "^arch=('x86_64')$" PKGBUILD; echo $?) == 0 ]] && [[ -e pkgbuildinstallations64 ]]; then
	echo >> PKGBUILD
	cat pkgbuildinstallations64 | while read line; do
		echo -e "	$line" >> PKGBUILD
	done
fi
if [[ -e pkgbuildinstallations2 ]]; then
	echo >> PKGBUILD
	cat pkgbuildinstallations2 | while read line; do
		echo -e "	$line" >> PKGBUILD
	done
fi
if [[ -e pkgbuildinstallations1 ]] || [[ -e pkgbuildinstallations2 ]] || [[ -e pkgbuildinstallations32 ]] || [[ -e pkgbuildinstallations64 ]]; then
	if [[ $(grep '^install' pkgbuildinstallations1 2> /dev/null | wc -l) != $(echo $(($(cat pkgbuildinstallations1 2> /dev/null | wc -l) + $(cat pkgbuildinstallations2 2> /dev/null | wc -l) + $(cat pkgbuildinstallations32 2> /dev/null | wc -l) + $(cat pkgbuildinstallations64 2> /dev/null | wc -l)))) ]]; then
		echo -e "\n	cd .." >> PKGBUILD
	fi
fi
echo -e "\n}" >> PKGBUILD

# Moving PKGBUILD (and .INSTALL, if it exists) and announcing its creation
pkgname="$(grep '^pkgname=' PKGBUILD | sed s'/^pkgname=//')"
rm -rf "../$pkgname" 2> /dev/null
mkdir "../$pkgname" 2> /dev/null
if [[ $(echo $?) != 0 ]]; then
	echo -e "${red}Error: Cannot create PKGBUILD directory, permission denied. Removing leftover files and exiting...${NC}"
	cd ..
	rm -rf "$working_directory"
	rm -rf /tmp/debtap
	exit 1
fi
mv PKGBUILD "../$pkgname"
pkgbuild_with_full_path="$(readlink -f "../$pkgname/PKGBUILD")"
pkgbuild_location="$(dirname "$pkgbuild_with_full_path")"
if [[ -e .INSTALL ]]; then
	mv .INSTALL "../$pkgname/$pkgname.install"
	echo -e "${lightgreen}==>${NC} ${bold}PKGBUILD and "$pkgname.install" are now located in${normal} ${lightblue}\"$pkgbuild_location\"${NC} ${bold}and ready to be edited${normal}"
else
	echo -e "${lightgreen}==>${NC} ${bold}PKGBUILD is now located in${normal} ${lightblue}\"$pkgbuild_location\"${NC} ${bold}and ready to be edited${normal}"
fi

# Removing leftover files
echo -e "${lightgreen}==>${NC} ${bold}Removing leftover files...${normal}"
cd ..
rm -rf "$working_directory"
rm -rf /tmp/debtap
exit 0
